diff --git a/Makefile b/Makefile index df20f94..3586697 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,15 @@ NOSSP_SRCS = $(wildcard crt/*.c) \ src/ldso/dlstart.c src/ldso/dynlink.c $(NOSSP_SRCS:%.c=%.o) $(NOSSP_SRCS:%.c=%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP) +# TODO: update the list when aliasing violations are fixed +NOLTO_SRCS = $(wildcard crt/*.c) \ + src/ldso/dlstart.c \ + src/string/stpcpy.c src/string/strlen.c \ + src/string/strchrnul.c src/string/memchr.c \ + src/string/memccpy.c str/string/strlcpy.c \ + src/string/strncpy.c +$(NOLTO_SRCS:%.c=%.o) $(NOLTO_SRCS:%.c=%.lo): CFLAGS_ALL += $(CFLAGS_NOLTO) + $(CRT_LIBS:lib/%=crt/%): CFLAGS_ALL += -DCRT # This incantation ensures that changes to any subarch asm files will diff --git a/configure b/configure index ee21771..4672ebb 100755 --- a/configure +++ b/configure @@ -113,6 +113,7 @@ CFLAGS_C99FSE= CFLAGS_AUTO= CFLAGS_MEMOPS= CFLAGS_NOSSP= +CFLAGS_NOLTO= CFLAGS_TRY= LDFLAGS_AUTO= LDFLAGS_TRY= @@ -344,6 +345,13 @@ tryflag CFLAGS_C99FSE -Wa,--noexecstack tryflag CFLAGS_NOSSP -fno-stack-protector # +# Check for options to disable LTO, which is needed for executable +# entry points and functions with aliasing violations. If not found, +# this is not an error; we assume the toolchain does not do LTO. +# +tryflag CFLAGS_NOLTO -fno-lto + +# # Check for options that may be needed to prevent the compiler from # generating self-referential versions of memcpy,, memmove, memcmp, # and memset. Really, we should add a check to determine if this @@ -660,6 +668,7 @@ CFLAGS_AUTO = $CFLAGS_AUTO CFLAGS_C99FSE = $CFLAGS_C99FSE CFLAGS_MEMOPS = $CFLAGS_MEMOPS CFLAGS_NOSSP = $CFLAGS_NOSSP +CFLAGS_NOLTO = $CFLAGS_NOLTO CPPFLAGS = $CPPFLAGS LDFLAGS = $LDFLAGS LDFLAGS_AUTO = $LDFLAGS_AUTO