update / correct some compilation and linkage settings

HOSTCFLAGS: Should not be set the same as CFLAGS since CFLAGS may be for a completely different platform.  Use sane defaults like other configs/*/*/Make.defs.

ARCHCPUFLAGS: Depending on how the GNU compiler was built we may need -fno-stack-protector.  Since we always want it we can just default to specifying it instead of depending on the compiler default.

LDFLAGS: If compiling for a 32 bit target from a 64 bit platform we need to tell the linker to generate a 32 bit elf file with -m elf_i386.
This commit is contained in:
Heath Petersen 2016-07-13 03:01:58 +00:00
parent 5be790b6dd
commit 9d999eeb34

View File

@ -63,8 +63,7 @@ else
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
endif
ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
#ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHDEFINES =
@ -73,6 +72,7 @@ ARCHDEFINES =
ifeq ($(CONFIG_ARCH_X86_M32),y)
ARCHCPUFLAGS += -m32
LDFLAGS += -m elf_i386
endif
# We have to use a cross-development toolchain under Cygwin because the native
@ -109,5 +109,5 @@ MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
HOSTCC = gcc
HOSTINCLUDESv = -I.
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =