Skip to content

Commit

Permalink
workaround to make -flto work in nix shell
Browse files Browse the repository at this point in the history
nix gcc comes with lto library, but binutils like ar doesn't seem to
properly configured regarding this.

The easiest workaround to make -flto work is therefore to avoid building
libraries, let gcc take over everything.

Signed-off-by: Thing-han, Lim <[email protected]>
  • Loading branch information
potsrevennil committed Nov 18, 2024
1 parent d30bc18 commit 019d43b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
4 changes: 1 addition & 3 deletions mk/bench.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
LIBDEPS += $(LIB_DIR)/libhal.a
LDLIBS += -lhal
CPPFLAGS += -Itest/hal
$(LIB_DIR)/libhal.a: $(call OBJS,$(wildcard test/hal/*.c))
SOURCES += $(wildcard test/hal/*.c)
11 changes: 2 additions & 9 deletions mk/crypto.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
LDLIBS += -L$(LIB_DIR)

LIBDEPS += $(LIB_DIR)/libfips202.a
LDLIBS += -lfips202
CPPFLAGS += -Ifips202 -Ifips202/native

FIPS202_SRCS = $(wildcard fips202/*.c)
SOURCES += $(wildcard fips202/*.c)
ifeq ($(OPT),1)
FIPS202_SRCS += $(wildcard fips202/native/aarch64/*.S) $(wildcard fips202/native/x86_64/xkcp/*.c)
CPPFLAGS += -DMLKEM_USE_NATIVE
SOURCES += $(wildcard fips202/native/aarch64/*.S) $(wildcard fips202/native/x86_64/xkcp/*.c)
endif

$(LIB_DIR)/libfips202.a: $(call OBJS, $(FIPS202_SRCS))
2 changes: 1 addition & 1 deletion mk/schemes.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
SOURCES = $(wildcard mlkem/*.c) $(wildcard mlkem/debug/*.c)
SOURCES += $(wildcard mlkem/*.c) $(wildcard mlkem/debug/*.c)
ifeq ($(OPT),1)
SOURCES += $(wildcard mlkem/native/aarch64/*.[csS]) $(wildcard mlkem/native/x86_64/*.[csS])
CPPFLAGS += -DMLKEM_USE_NATIVE
Expand Down

0 comments on commit 019d43b

Please sign in to comment.