galileo: Override Ubuntu's default GCC flags to avoid link errors

Ubuntu enables GCC's stack protector by default (see
https://wiki.ubuntu.com/Security/Features).  This causes link errors
like the following:

 ...undefined reference to `__stack_chk_fail'

To avoid these errors, this patch adds the "-fno-stack-protector" flag
to both the CFLAGS used by the Contiki build process and the CFLAGS
used by the newlib build process.
This commit is contained in:
Michael LeMay 2015-07-02 19:14:04 -07:00 committed by Jesus Sanchez-Palencia
parent 13bbe8a5b5
commit b79fcaa7d8
2 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@ CONTIKI_SOURCEFILES += contiki-main.c newlib-syscalls.c clock.c rtimer-arch.c
CONTIKI_CPU=$(CONTIKI)/cpu/x86 CONTIKI_CPU=$(CONTIKI)/cpu/x86
include $(CONTIKI)/cpu/x86/Makefile.x86_quarkX1000 include $(CONTIKI)/cpu/x86/Makefile.x86_quarkX1000
CFLAGS += -m32 -march=i586 -nostdinc -isystem $(LIBC)/include -isystem $(LIBGCC_PATH)/include -isystem $(LIBGCC_PATH)/include-fixed CFLAGS += -m32 -march=i586 -fno-stack-protector -nostdinc -isystem $(LIBC)/include -isystem $(LIBGCC_PATH)/include -isystem $(LIBGCC_PATH)/include-fixed
LDFLAGS += -m32 -nostdlib -T $(LINKERSCRIPT) LDFLAGS += -m32 -nostdlib -T $(LINKERSCRIPT)
ASFLAGS += --32 -march=i586 -mtune=i586 ASFLAGS += --32 -march=i586 -mtune=i586

View file

@ -57,8 +57,8 @@ build() {
export COMPILER_AS_FOR_TARGET=as export COMPILER_AS_FOR_TARGET=as
export COMPILER_LD_FOR_TARGET=ld export COMPILER_LD_FOR_TARGET=ld
export COMPILER_NM_FOR_TARGET=nm export COMPILER_NM_FOR_TARGET=nm
export CFLAGS_FOR_TARGET="-Os -m32 -march=i586 -mtune=i586 -DPREFER_SIZE_OVER_SPEED" export CFLAGS_FOR_TARGET="-Os -m32 -march=i586 -mtune=i586 -fno-stack-protector -DPREFER_SIZE_OVER_SPEED"
export CXXFLAGS_FOR_TARGET="-Os -m32 -march=i586 -mtune=i586 -DPREFER_SIZE_OVER_SPEED" export CXXFLAGS_FOR_TARGET="-Os -m32 -march=i586 -mtune=i586 -fno-stack-protector -DPREFER_SIZE_OVER_SPEED"
mkdir -p install mkdir -p install
./configure --target=${TARGET} \ ./configure --target=${TARGET} \