public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manojgupta at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/98946] New: GCC generating incorrect relocation R_386_GOTOFF in .debug-info for x86 (32)
Date: Tue, 02 Feb 2021 23:59:25 +0000	[thread overview]
Message-ID: <bug-98946-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946

            Bug ID: 98946
           Summary: GCC generating incorrect relocation R_386_GOTOFF in
                    .debug-info for x86 (32)
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manojgupta at google dot com
  Target Milestone: ---

Created attachment 50116
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50116&action=edit
pre-processed files and gcc command limes

This might be related to an older bug 82630 that fixed a similar issue for
R_386_GOTPC relocations.

Chromium OS bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1171829

We are hitting a similar problem when upgrading to GCC 10.2.1 in Chrome OS. the
affected files are in glibc 2.27 where the presence of R_386_GOTOFF is causing
LLD linker to complain. This is breaking static linking on 32-bit for us.

The errors look like:
ld.lld: error: dl-close.c:(.debug_info+0x1E6A): has non-ABS relocation
R_386_GOTOFF against symbol '.LC3'
ld.lld: error: dl-profile.c:(.debug_info+0x1A7C): has non-ABS relocation
R_386_GOTOFF against symbol '.LC4'
ld.lld: error: dl-lookup.c:(.debug_info+0x23FA): has non-ABS relocation
R_386_GOTOFF against symbol '.LC8'
ld.lld: error: dl-reloc.c:(.debug_info+0x3555): has non-ABS relocation
R_386_GOTOFF against symbol '.LC7'
ld.lld: error: dl-load.c:(.debug_info+0x1B1C): has non-ABS relocation
R_386_GOTOFF against symbol '.LC65'
ld.lld: error: malloc.c:(.debug_info+0x28D5): has non-ABS relocation
R_386_GOTOFF against symbol '.LC2'
ld.lld: error: plural.c:(.debug_loc+0xFA4): has non-ABS relocation R_386_GOTOFF
against symbol 'yyr2'

It was suggested on the bug by Fangrui who is our LLD expert that this might be
a GCC bug.
"Relocations from .debug_info referencing .text.* can only be absolute
relocation types or DTPREL (TLS)-like."

There was a previous fix for a similar bug:
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=6b10f1741a1d79c9e32e8790fb98ba93c864b219
. Maybe the fix needs to be extended to handle the R_386_GOTOFF relocations.

I am attaching one of the files LLD is complaining (dl-close.c) with
intermediate steps and output of "-v" command line. The assembler being used is
GNU assembler 2.35.1.

Please let me know if more information is needed.

             reply	other threads:[~2021-02-02 23:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 23:59 manojgupta at google dot com [this message]
2021-02-03  1:27 ` [Bug debug/98946] " manojgupta at google dot com
2021-02-03  2:40 ` manojgupta at google dot com
2021-02-03  7:49 ` rguenth at gcc dot gnu.org
2021-02-03  7:50 ` rguenth at gcc dot gnu.org
2021-02-03  7:57 ` jakub at gcc dot gnu.org
2021-02-04  2:49 ` manojgupta at google dot com

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=bug-98946-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).