diff options
author | Peng Fan <Peng.Fan@freescale.com> | 2015-12-03 09:47:48 +0800 |
---|---|---|
committer | guoyin.chen <guoyin.chen@freescale.com> | 2016-03-04 15:35:49 +0800 |
commit | 61a50c597d265787136c74e76ab41276357d9024 (patch) | |
tree | 29f486177a36995b8c75da60f89a27a19f5cb4c7 /arch | |
parent | a8de2a9007562374e7ce4fed39937a04b7ad35a7 (diff) |
MLK-11946 arm: config: disable pic when compiling code
Android's tool chain enable the -mandroid at default.
This option will enable the -fpic, which cause uboot compilation
failure:
"
LD u-boot
u-boot contains unexpected relocations: R_ARM_ABS32
R_ARM_RELATIVE
"
In my testcase, arm-linux-androideabi-gcc-4.9 internally
enables '-fpic', so when compiling code, there will be
relocation entries using type R_ARM_GOT_BREL and .got
section. When linking all the built-in.o using ld, there
will be R_ARM_ABS32 relocation entry and .got section
in the final u-boot elf image. This can not be handled
by u-boot, since u-boot only expects R_ARM_RELATIVE
relocation entry.
arm-poky-linux-gnueabi-gcc-4.9 default does not enable '-fpic',
so there is not .got section and R_ARM_GOT_BREL in built-in.o.
And in the final u-boot elf image, all relocation entries are
R_ARM_RELATIVE.
we can pass '-fno-pic' to xxx-gcc to disable pic. whether
the toolchain internally enables or disables pic, '-fno-pic'
can work well.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/config.mk | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm/config.mk b/arch/arm/config.mk index c005ce4..334b879 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -106,6 +106,7 @@ ALL-y += checkarmreloc # instruction. Relocation is not supported for that case, so disable # such usage by requiring word relocations. PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations) +PLATFORM_CPPFLAGS += $(call cc-option, -fno-pic) endif # limit ourselves to the sections we want in the .bin. |