diff --git a/armsrc/Makefile b/armsrc/Makefile index 6df152e80..bbc26c8f9 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -31,8 +31,7 @@ endif #remove one of the following defines and comment out the relevant line #in the next section to remove that particular feature from compilation. # NO space,TABs after the "\" sign. -APP_CFLAGS = $(PLATFORM_DEFS) \ - -ffunction-sections -fdata-sections +APP_CFLAGS = $(PLATFORM_DEFS) SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c lfadc.c SRC_HF = hfops.c @@ -115,8 +114,7 @@ APP_CFLAGS += $(LZ4_CFLAGS) APP_CFLAGS += -I../common/lz4 # stdint.h provided locally until GCC 4.5 becomes C99 compliant, -# stack-protect , no-pie reduces size on Gentoo Hardened 8.2 gcc -APP_CFLAGS += -I. -fno-stack-protector -fno-pie +APP_CFLAGS += -I. # Compile these in thumb mode (small size) THUMBSRC = start.c \ diff --git a/bootrom/Makefile b/bootrom/Makefile index d261bc090..6a662dede 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -34,10 +34,10 @@ VERSIONSRC = version_pm3.c # THUMBSRC := # stdint.h provided locally until GCC 4.5 becomes C99 compliant -APP_CFLAGS = -I. -ffunction-sections -fdata-sections -DAS_BOOTROM +APP_CFLAGS = -I. -DAS_BOOTROM -# stack-protect , no-pie reduces size on Gentoo Hardened 8.2 gcc, no-common makes sure uninitialized vars don't end up in COMMON area -APP_CFLAGS += -fno-stack-protector -fno-pie -fno-common +# no-common makes sure uninitialized vars don't end up in COMMON area +APP_CFLAGS += -fno-common ifneq (,$(findstring WITH_FLASH,$(PLATFORM_DEFS))) APP_CFLAGS += -DWITH_FLASH diff --git a/common_arm/Makefile.common b/common_arm/Makefile.common index e8e574112..7ce4c8f19 100644 --- a/common_arm/Makefile.common +++ b/common_arm/Makefile.common @@ -48,7 +48,6 @@ VPATH = . ../common_arm ../common ../common/crapto1 ../common/mbedtls ../common/ INCLUDES = ../include/proxmark3_arm.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/pm3_cmd.h -ARMCFLAGS = -mthumb-interwork -fno-builtin DEFCFLAGS = -Wall -Werror -Os -pedantic -fstrict-aliasing -pipe # Some more warnings we want as errors: @@ -99,9 +98,14 @@ ifeq ($(NOERROR),1) endif CROSS_CFLAGS ?= $(DEFCFLAGS) -CROSS_CFLAGS += $(ARMCFLAGS) -c $(INCLUDE) -std=c99 -DON_DEVICE $(APP_CFLAGS) +CROSS_CFLAGS += -c -std=c99 -mthumb-interwork -fno-builtin -ffunction-sections -fdata-sections +# stack-protect, no-pie reduces size on Gentoo Hardened 8.2 gcc +CROSS_CFLAGS += -fno-stack-protector -fno-pie +CROSS_CFLAGS += -DON_DEVICE $(INCLUDE) $(APP_CFLAGS) + +CROSS_LDFLAGS += -nostartfiles -nodefaultlibs -Wl,--gc-sections -Wl,--build-id=none -Wl,--nmagic +#CROSS_LDFLAGS += -Wl,--print-gc-sections -CROSS_LDFLAGS += -nostartfiles -nodefaultlibs -Wl,-gc-sections -Wl,--build-id=none -n LIBS = -lgcc # Flags to generate temporary dependency files