public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: "H.J. Lu" <hjl.tools@gmail.com>,
	Pierre Labastie <pierre.labastie@neuf.fr>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: question: i386 ld.gold reports "internal error" linking files with SHT_RELA section
Date: Wed, 31 Aug 2022 12:43:25 +0800	[thread overview]
Message-ID: <b26f5fe43b18cc8a43c86dd1d6c453e749616a8a.camel@xry111.site> (raw)
In-Reply-To: <CAMe9rOpev=9c65HWFwZLQvKcjRq9SUQ4MSKMPQirAwcDELBMHg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

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

[-- Attachment #2: t.o.gz --]
[-- Type: application/gzip, Size: 586 bytes --]

[-- Attachment #3: t.asm --]
[-- Type: text/plain, Size: 232 bytes --]

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

  reply	other threads:[~2022-08-31  4:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 14:38 Xi Ruoyao
2022-08-30 18:21 ` H.J. Lu
2022-08-30 18:53   ` Pierre Labastie
2022-08-30 20:36     ` H.J. Lu
2022-08-31  4:43       ` Xi Ruoyao [this message]
2022-08-31 19:20         ` H.J. Lu
2022-09-01  0:47           ` Xi Ruoyao
2022-09-01 16:34             ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b26f5fe43b18cc8a43c86dd1d6c453e749616a8a.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=pierre.labastie@neuf.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).