lm32 fdpic toolchain segfault with binutils ld

Waldemar Brodkorb wbx@openadk.org
Sat Nov 4 18:02:00 GMT 2017


Hi,

I try to cross-compile Linux and uClibc-ng for lm32.
Support for FDPIC seems to be the default in binutils/gcc.
Linux kernel support is not upstream, you can find the used
source here:
https://github.com/m-labs/linux-milkymist.git

When the kernel is linked I get a segmentation fault:
/home/wbx/lm32/toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-ld:
BFD (GNU Binutils) 2.29.51.20171028 assertion fail elf32-lm32.c:902

Before that there are a lot of warnings:
/home/wbx/lm32/toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-ld:
Warning: size of symbol `sys_getpeername' changed from 8 in
kernel/built-in.o to 192 in net/built-in.o

wbx@chrom:~/lm32$ gdb
./toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-ld.bfd core
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from
./toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-ld.bfd...done.

warning: core file may not match specified executable file.
[New LWP 4126]
Core was generated by
`/home/wbx/lm32/toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclib'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000560650c0aebb in lm32_elf_relocate_section
(output_bfd=0x560652c1ff30, info=0x560650f05600 <link_info>,
input_bfd=0x560652c30730, input_section=0x560652c31910, 
    contents=0x7f5fd93a1010 "7\234\377\324[\213",
relocs=0x7f5fd9332010, local_syms=0x5606530ff320,
local_sections=0x560653123490) at elf32-lm32.c:938
938                               bfd_put_32 (output_bfd,
relocation,
(gdb) bt
#0  0x0000560650c0aebb in lm32_elf_relocate_section
(output_bfd=0x560652c1ff30, info=0x560650f05600 <link_info>,
input_bfd=0x560652c30730, input_section=0x560652c31910, 
    contents=0x7f5fd93a1010 "7\234\377\324[\213",
relocs=0x7f5fd9332010, local_syms=0x5606530ff320,
local_sections=0x560653123490) at elf32-lm32.c:938
#1  0x0000560650c43c7f in elf_link_input_bfd (flinfo=0x7ffcae689c20,
input_bfd=0x560652c30730) at elflink.c:10633
#2  0x0000560650c46df0 in bfd_elf_final_link (abfd=0x560652c1ff30,
info=0x560650f05600 <link_info>) at elflink.c:11944
#3  0x0000560650bdede0 in ldwrite () at ldwrite.c:577
#4  0x0000560650bdbf87 in main (argc=28, argv=0x7ffcae68a028) at
./ldmain.c:448
(gdb) quit

wbx@chrom:~/lm32$
./toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-gcc
-v
Using built-in specs.
COLLECT_GCC=./toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-gcc
COLLECT_LTO_WRAPPER=/home/wbx/lm32/toolchain_qemu-lm32_uclibc-ng/usr/libexec/gcc/lm32-openadk-uclinux-uclibc/7.2.0/lto-wrapper
Target: lm32-openadk-uclinux-uclibc
Configured with:
/home/wbx/lm32/toolchain_build_qemu-lm32_uclibc-ng/w-gcc-7.2.0-1/gcc-7.2.0/configure
--prefix=/home/wbx/lm32/toolchain_qemu-lm32_uclibc-ng/usr
--with-bugurl=http://www.openadk.org/ --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=lm32-openadk-uclinux-uclibc
--with-gmp=/home/wbx/lm32/host_x86_64-linux-gnu/usr
--with-mpfr=/home/wbx/lm32/host_x86_64-linux-gnu/usr
--disable-__cxa_atexit --with-system-zlib --with-gnu-ld
--with-gnu-as --disable-libsanitizer --disable-install-libiberty
--disable-libitm --disable-libmudflap --disable-libgomp
--disable-libmpx --disable-libcilkrts --disable-libquadmath
--disable-libquadmath-support --disable-decimal-float
--disable-libstdcxx-pch --disable-ppl-version-check
--disable-cloog-version-check --without-ppl --without-cloog
--without-isl --disable-werror --disable-nls --disable-lto
--disable-tls --disable-threads --disable-libatomic --disable-shared
--disable-libssp --disable-biarch --disable-multilib
--enable-languages=c
--with-build-sysroot='/../../target_qemu-lm32_uclibc-ng'
--with-sysroot='/../../target_qemu-lm32_uclibc-ng'
Thread model: single
gcc version 7.2.0 (GCC) 
wbx@chrom:~/lm32$
./toolchain_qemu-lm32_uclibc-ng/usr/bin/lm32-openadk-uclinux-uclibc-ld
-v
GNU ld (GNU Binutils) 2.29.51.20171028

Any ideas? What else do I need to provide? 
Core file?

best regards
 Waldemar



More information about the Binutils mailing list