question: i386 ld.gold reports "internal error" linking files with SHT_RELA section
Xi Ruoyao
xry111@xry111.site
Wed Aug 31 04:43:25 GMT 2022
On Tue, 2022-08-30 at 13:36 -0700, H.J. Lu wrote:
> > > SHT_RELA shouldn't be used for i386.
> >
> > But it is accepted by ld.bfd...
>
> Do you have .o files for ld.bfd I can take a look at?
>
> > FWIIW, only the dwarf debug sections are generated as SHT_RELA by
> > nasm.
Hi,
$ cat t.asm
section .text
extern printf
global main
main:
push ebp
mov ebp, esp
push msg
call printf
add esp, 4
leave
ret
section .data
msg db 'Hello, world!', 13, 10, 0
section .note.GNU-stack noalloc noexec nowrite progbits
$ nasm t.asm -f elf32 -F dwarf
$ cc t.o && ./a.out
Hello, world!
$ cc -fuse-ld=gold t.o
/usr/bin/ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3683
collect2: error: ld returned 1 exit status
I'll attach "t.asm' and "t.o.gz".
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.o.gz
Type: application/gzip
Size: 586 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20220831/2695ebab/attachment.gz>
-------------- next part --------------
section .text
extern printf
global main
main:
push ebp
mov ebp, esp
push msg
call printf
add esp, 4
leave
ret
section .data
msg db 'Hello, world!', 13, 10, 0
section .note.GNU-stack noalloc noexec nowrite progbits
More information about the Binutils
mailing list