This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Binutils 2.28 on PowerPC: dangerous relocation: generic linker can't handle R_PPC_SECTOFF_HA
- From: Alan Modra <amodra at gmail dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Cc: binutils <binutils at sourceware dot org>
- Date: Wed, 8 May 2019 18:11:53 +0930
- Subject: Re: Binutils 2.28 on PowerPC: dangerous relocation: generic linker can't handle R_PPC_SECTOFF_HA
- References: <118142359.142184.1496311674176.JavaMail.zimbra@embedded-brains.de> <20170601104238.GD8842@bubble.grove.modra.org> <130569507.142235.1496314732401.JavaMail.zimbra@embedded-brains.de> <48291758.142314.1496315282926.JavaMail.zimbra@embedded-brains.de> <20170601140636.GN8842@bubble.grove.modra.org> <1820249782.143803.1496380818607.JavaMail.zimbra@embedded-brains.de> <9a27522e-6a4e-ed0b-3ac4-cb30c027268d@embedded-brains.de>
On Tue, May 07, 2019 at 10:30:40AM +0200, Sebastian Huber wrote:
> powerpc-rtems4.9-ld --version
> GNU ld (GNU Binutils) 2.19.1
>
> With this LD version I can boot the application. The LD output is a binary
> file. I had to remove the OUTPUT_ARCH(powerpc) from ppcboot.lds.
>
> Since at least Binutils 2.28, it no longer works:
>
> powerpc-rtems5-ld -o ticker.ralf
> /build/git-build/b-any/powerpc-rtems5/mvme2100/lib/bootloader.o
> --just-symbols=ticker.exe -b binary rtems.gz -T
> ~/git-rtems-5/./bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
> /build/git-build/b-any/powerpc-rtems5/mvme2100/lib/bootloader.o: in function
> `start':
> /home/EB/sebastian_h/git-rtems-5/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/../../../../../../../bsps/powerpc/motorola_powerpc/bootloader/head.S:140:(.text+0x8a):
> dangerous relocation: generic linker can't handle R_PPC_SECTOFF_HA
> /home/EB/sebastian_h/git-rtems-5/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/../../../../../../../bsps/powerpc/motorola_powerpc/bootloader/head.S:141:(.text+0x8e):
The truth is that linking to binary with 2.19 did not handle any of
the R_PPC_SECTOFF relocations correctly. They were handled just like
the corresponding R_PPC_ADDR16 reloc, a fact that you can verify by
comparing the reloc howtos. (Reloc howtos are used by the generic
linker to apply relocations. When linking to powerpc ELF you'll be
using the code in ppc_elf_relocate_section instead.) So the values
applied by 2.19 were symbol values rather than symbol values relative
to their output section.
I think that means your assembly code has compensated for the 2.19
linker behaviour by some means or other, and therefore crashes with a
fixed linker.
You'll probably find that using 2.19 to link to ELF then objcopy to
binary will also give you a "bad" output.
[snip]
> powerpc-rtems5-ld -o ticker.ralf
> /build/git-build/b-any/powerpc-rtems5/mvme2100/lib/bootloader.o
> --just-symbols=ticker.exe -b binary rtems.gz -T
> ~/git-rtems-5/./bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
> powerpc-rtems5-ld: ticker.exe uses hard float,
> /build/git-build/b-any/powerpc-rtems5/mvme2100/lib/bootloader.o uses soft
> float
> powerpc-rtems5-ld: failed to merge target specific data of file ticker.exe
I guess you could argue that it's a bug to complain about
--just-symbols target specific data.
--
Alan Modra
Australia Development Lab, IBM