linux/arch/arm/vdso
Nathan Lynch d2b30cd4b7 ARM: 8384/1: VDSO: force use of BFD linker
When using a toolchain with gold as the default linker, the VDSO build
fails:

  VDSO    arch/arm/vdso/vdso.so.raw
  HOSTCC  arch/arm/vdso/vdsomunge
  MUNGE   arch/arm/vdso/vdso.so.dbg
  OBJCOPY arch/arm/vdso/vdso.so
BFD: arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N

For whatever reason, ld.gold is omitting an exidx program header that
ld.bfd emits, and even when I work around that, I don't get a working
VDSO.

For now, instead of supporting gold (which will fail to link the
kernel anyway since it does not implement --pic-veneer), direct the
compiler to use the traditional bfd linker.  This is accomplished by
using -fuse-ld, which is implemented in GCC 4.8 and later.

Note: one limitation of this is that if the toolchain is configured
to use gold by default, and the bfd linker is not in $PATH, the VDSO
build will fail:

  VDSO    arch/arm/vdso/vdso.so.raw
collect2: fatal error: cannot find 'ld'

This will happen if CROSS_COMPILE begins with a path such as
/opt/bin/arm-linux-gnu- but /opt/bin is not in $PATH.  This is
considered an acceptable corner-case limitation and is easily worked
around.

Additonal note: we use cc-option instead of cc-ldoption so that
-fuse-ld=bfd is placed in the command line if the compiler recognizes
the option.  Using cc-ldoption results in an attempt to link, which
fails in the situation just described, causing -fuse-ld=bfd to be
omitted and gold to be used for the VDSO link, which is what we're
trying to prevent.

Reported-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2015-06-06 10:37:12 +01:00
..
.gitignore ARM: 8343/1: VDSO: add build artifacts to .gitignore 2015-04-21 15:27:53 +01:00
datapage.S ARM: 8330/1: add VDSO user-space code 2015-03-27 22:20:45 +00:00
Makefile ARM: 8384/1: VDSO: force use of BFD linker 2015-06-06 10:37:12 +01:00
vdso.lds.S ARM: 8330/1: add VDSO user-space code 2015-03-27 22:20:45 +00:00
vdso.S ARM: 8330/1: add VDSO user-space code 2015-03-27 22:20:45 +00:00
vdsomunge.c ARM: 8330/1: add VDSO user-space code 2015-03-27 22:20:45 +00:00
vgettimeofday.c ARM: 8330/1: add VDSO user-space code 2015-03-27 22:20:45 +00:00