[U-Boot] ARM: problems with elf relocation on arm920t / maybe toolchain related

Andreas Bießmann andreas.devel at googlemail.com
Sun Oct 31 08:11:07 CET 2010


Dear Albert Aribaud,

in reply to http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/88014/focus=88022 I have to tell another issue. I try to get the elf relocation stuff working for arm920t and run into some compiler issues. Sorry, had no time to investigate that but maybe one has some pointers?

I have have adopted your changes to arm926ejs to arm920t and built that with my own toolchain (gcc 4.5.1, binutils 2.20.1.20100303) and codesourcery 2010q1-202. The codesourcery report is compareable so i send it here:

---8<---
...
cd /tmp/build_uboot-at91rm9200ek && arm-none-linux-gnueabi-ld -Bstatic -T /tmp/build_uboot-at91rm9200ek/u-boot.lds  -pie -Ttext 0x21000000 $UNDEF_SYM arch/arm/cpu/arm920t/start.o --start-group lib/libgeneric.a lib/lzma/liblzma.a lib/lzo/liblzo.a arch/arm/cpu/arm920t/libarm920t.a arch/arm/cpu/arm920t/at91/libat91.a arch/arm/lib/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a lib/libfdt/libfdt.a api/libapi.a post/libpost.a board/atmel/at91rm9200ek/libat91rm9200ek.a --end-group /tmp/build_uboot-at91rm9200ek/arch/arm/lib/eabi_compat.o -L /home/andreas/src/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1 -lgcc -Map u-boot.map -o u-boot
arm-none-linux-gnueabi-ld: BFD (Sourcery G++ Lite 2010q1-202) 2.19.51.20090709 assertion fail /scratch/julian/2010q1-release-linux-lite/obj/binutils-src-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:12338
arm-none-linux-gnueabi-ld: BFD (Sourcery G++ Lite 2010q1-202) 2.19.51.20090709 assertion fail /scratch/julian/2010q1-release-linux-lite/obj/binutils-src-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:12572
/bin/sh: line 1: 12104 Speicherzugriffsfehler  arm-none-linux-gnueabi-ld -Bstatic -T /tmp/build_uboot-at91rm9200ek/u-boot.lds -pie -Ttext 0x21000000 $UNDEF_SYM arch/arm/cpu/arm920t/start.o --start-group lib/libgeneric.a lib/lzma/liblzma.a lib/lzo/liblzo.a arch/arm/cpu/arm920t/libarm920t.a arch/arm/cpu/arm920t/at91/libat91.a arch/arm/lib/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a lib/libfdt/libfdt.a api/libapi.a post/libpost.a board/atmel/at91rm9200ek/libat91rm9200ek.a --end-group /tmp/build_uboot-at91rm9200ek/arch/arm/lib/eabi_compat.o -L /home/andreas/src/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1 -lgcc -Map u-boot.map -o u-boot
make: *** [/tmp/build_uboot-at91rm9200ek/u-boot] Fehler 139
...
--->8---

My self built toolchain runs into the same assertions, I think so at least. I wonder whether this is a pure toolchain problem/bug or if it have some connection to the input and maybe we are missing a essential thing? I had a short look into the binutils code and found it crashes when looking up .plt sections which are discarded in linker script. See the following snippet of binutils-2.20.1/bfd/elf32-arm.c near lines 12337

---8<---
static bfd_boolean
elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info)
...
  if (elf_hash_table (info)->dynamic_sections_created)
...
      for (; dyncon < dynconend; dyncon++)
...
          bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);

          switch (dyn.d_tag)
...
            case DT_PLTRELSZ:
              s = bfd_get_section_by_name (output_bfd,
                                           RELOC_SECTION (htab, ".plt"));
              BFD_ASSERT (s != NULL);                                                 <- second assertion
              dyn.d_un.d_val = s->size;                                                   <- segfault
              bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
...
--->8---

My changes in arm920t/start.S will follow. The board to test is at91rm9200ek. Maybe one can test my changes with ELDK toolchain?

regards

Andreas Bießmann


More information about the U-Boot mailing list