bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/24426] Binutils 2.28.1 segfault when presented (any) linker scri


From: wilson at gcc dot gnu.org
Subject: [Bug ld/24426] Binutils 2.28.1 segfault when presented (any) linker script on riscv64
Date: Tue, 09 Apr 2019 18:55:56 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=24426

--- Comment #7 from Jim Wilson <wilson at gcc dot gnu.org> ---
An empty linker script isn't expected to work.  This will probably fail for
every linker target.  It fails for x86_64-linux for instance.

rohan:2037$ uname -a
Linux rohan 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019
x86_64 x86_64 x86_64 GNU/Linux
rohan:2038$ gcc -Ttmp.ld tmp.c
/usr/bin/ld: a.out: Not enough room for program headers, try linking with -N
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
rohan:2039$ 

The linker shouldn't crash, but you've done something funny here though.  You
are either using a non-standard gcc or non-standard gcc options, which have
enabled some kind of consistency checking support.  Since you haven't explained
what you did, I am unable to reproduce the failures you are seeing.  You also
have non-standard libraries which appear to conflict with the published RISC-V
psABI.  This also prevents me from reproducing the failures you are seeing.

A RISC-V linux toolchain:

hifiveu017:1009$ uname -a
Linux hifiveu017 4.15.0-00049-ga3b1e7acc6a1-dirty #25 SMP Wed Oct 17 12:54:45
PDT 2018 riscv64 riscv64 riscv64 GNU/Linux
hifiveu017:1010$ gcc -Ttmp.ld tmp.c
/usr/bin/ld: /lib64/lp64d/../lib64/lp64d/crt1.o: in function `.L0 ':
(.text+0x2e): undefined reference to `__global_pointer$'
/usr/bin/ld: /usr/lib64/lp64d/libc_nonshared.a(elf-init.oS): in function `.L0
':
(.text+0x6): undefined reference to `__init_array_start'
/usr/bin/ld: (.text+0xe): undefined reference to `__init_array_end'
/usr/bin/ld: a.out: hidden symbol `__init_array_end' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
hifiveu017:1011$ 

A RISC-V embedded elf toolchain using newlib:

rohan:2041$ riscv64-unknown-elf-gcc -Ttmp.ld tmp.c
/home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld:
/home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/lib/crt0.o:
in function `_start':
(.text+0x0): undefined reference to `__global_pointer$'
/home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld:
(.text+0x8): undefined reference to `_edata'
/home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld:
(.text+0x10): undefined reference to `_end'
collect2: error: ld returned 1 exit status
rohan:2042$ 

If you want me to reproduce what you are seeing, you must give me all of the
info necessary to reproduce from the beginning, e.g. what system you are
building on, how you configure and build binutils, maybe include the libraries
you are linking with in the bug report, etc.

The gp register, global pointer variable, and sdata sections have existed since
the early 1980s at least.  They are standard for MIPS toolchains, and any
toolchain that uses MIPS style ABI conventions.  There are about half a dozen
of them in GNU ld, including RISC-V.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]