public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/99606] New: [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63
@ 2021-03-15 14:56 marxin at gcc dot gnu.org
  2021-03-15 14:56 ` [Bug debug/99606] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-15 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99606
           Summary: [10/11 Regression] ld.bfd: DWARF error: could not find
                    abbrev number 64 since r10-7521-g54af95767e887d63
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

I noticed that for a package that used to link successfully:

$ cat foma.i
char main_prompt[1];
int sprintf(char *, char *, ...);
void stack_size();
void main() { sprintf(main_prompt, "", stack_size); }

$ gcc -gdwarf-5 -Werror -O2 foma.i -flto=auto -g -c && gcc -fPIC foma.o
-flto=16 -fuse-ld=bfd -gdwarf-5
/usr/bin/ld.bfd: /usr/bin/ld.bfd: DWARF error: could not find abbrev number 64
/tmp/ccmeHh1F.ltrans0.ltrans.o: in function `main':
<artificial>:(.text.startup+0x3): undefined reference to `stack_size'
collect2: error: ld returned 1 exit status

A similar test-case triggers error for ld.gold:

$ cat foma.i
int printf(char *, ...);
      int sprintf(char *, char *, ...);
      void stack_size();
      char main_prompt[1];
      void main() {
       sprintf(main_prompt, "", stack_size);
       printf("\n");
     }

$ gcc -gdwarf-5 -Werror -O2 foma.i -flto=auto -g -c && gcc -fPIC foma.o
-flto=16 -fuse-ld=gold -gdwarf-5
/usr/bin/ld.gold: internal error in format_file_lineno, at
../../gold/dwarf_reader.cc:2278
collect2: error: ld returned 1 exit status

$ gcc -gdwarf-5 -Werror -O2 foma.i -flto=auto -g -c && gcc -fPIC foma.o
-flto=16 -fuse-ld=bfd -gdwarf-5
/usr/bin/ld.bfd: /usr/bin/ld.bfd: DWARF error: could not find abbrev number 64
/tmp/ccylqmOx.ltrans0.ltrans.o: in function `main':
<artificial>:(.text.startup+0x7): undefined reference to `stack_size'
collect2: error: ld returned 1 exit status

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/99606] [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63
  2021-03-15 14:56 [Bug debug/99606] New: [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63 marxin at gcc dot gnu.org
@ 2021-03-15 14:56 ` marxin at gcc dot gnu.org
  2021-03-16  7:43 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-15 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.2.0, 11.0
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |9.3.0
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-15

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/99606] [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63
  2021-03-15 14:56 [Bug debug/99606] New: [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63 marxin at gcc dot gnu.org
  2021-03-15 14:56 ` [Bug debug/99606] " marxin at gcc dot gnu.org
@ 2021-03-16  7:43 ` rguenth at gcc dot gnu.org
  2021-03-16 14:41 ` jakub at gcc dot gnu.org
  2021-03-18 14:35 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-16  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Somehow the refs to the early debug which use DW_FORM_ref_addr
and relocs in .rela.debug_info like

00000000002a  00140000000a R_X86_64_32       0000000000000000 t.i.5afc35f3 + 7e

do not work with -gdwarf-5, but I see nothing wrong with the objects so this
must be a linker issue?  Why would the linker even try to decode DWARF here?  I
suppose BFD fails to pick up the correct .debug_abbrev for the abstract origin
DIE and instead tries to use the refering .debug_abbrev.

With ld 2.35.1 I get a different error btw:

> ./xgcc -B. -gdwarf-5 -Werror -O2 t.i -flto -g  -v -save-temps
...
[Leaving LTRANS ./a.ltrans0.o]
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: DWARF
error: invalid abstract instance DIE ref
./a.ltrans0.ltrans.o: in function `main':
<artificial>:(.text.startup+0x1): undefined reference to `stack_size'
...

Maybe the BFD dwarf reader needed the import tags to pick up referenced CUs
(and their abbrevs).

I suppose the DWARF reads are triggered by the diagnostics (likewise for gold).
Maybe they are simply looking at unrelocated DWARF?

As said, this is a linker issue - the imports are technically not required.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/99606] [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63
  2021-03-15 14:56 [Bug debug/99606] New: [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63 marxin at gcc dot gnu.org
  2021-03-15 14:56 ` [Bug debug/99606] " marxin at gcc dot gnu.org
  2021-03-16  7:43 ` rguenth at gcc dot gnu.org
@ 2021-03-16 14:41 ` jakub at gcc dot gnu.org
  2021-03-18 14:35 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-16 14:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'm getting
DWARF error: invalid abstract instance DIE ref
error instead.  Weird.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/99606] [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63
  2021-03-15 14:56 [Bug debug/99606] New: [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-16 14:41 ` jakub at gcc dot gnu.org
@ 2021-03-18 14:35 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-18 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |MOVED
             Status|NEW                         |RESOLVED

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Linker bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-18 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 14:56 [Bug debug/99606] New: [10/11 Regression] ld.bfd: DWARF error: could not find abbrev number 64 since r10-7521-g54af95767e887d63 marxin at gcc dot gnu.org
2021-03-15 14:56 ` [Bug debug/99606] " marxin at gcc dot gnu.org
2021-03-16  7:43 ` rguenth at gcc dot gnu.org
2021-03-16 14:41 ` jakub at gcc dot gnu.org
2021-03-18 14:35 ` hjl.tools at gmail dot com

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).