public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/100725] New: dwarf error with --whole-program
@ 2021-05-22 14:37 fx at gnu dot org
  2021-05-23 11:12 ` [Bug debug/100725] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fx at gnu dot org @ 2021-05-22 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100725
           Summary: dwarf error with --whole-program
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fx at gnu dot org
  Target Milestone: ---

Extending my example in #100724 with -g, I see a dwarf error, which I assume is
a separate issue:

$ cat test.f90
module tw
  interface
     real function twice (x)
     end function twice
  end interface
end module tw

real function twice (x)
  twice = 2*x
end function twice

use tw
read *, x
print *, twice (x)
end
$ gfortran-11 -O2 -g -fwhole-program test.f90
/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
/tmp/cc8sFtAX.o: in function `MAIN__':
test.f90:(.text+0x7f): undefined reference to `twice_'
collect2: error: ld returned 1 exit status

Changing -g to -gdwarf-4 avoids the error, as does removing -fwhole-program. 
It also works with gcc-10 and -gdwarf-5.  The system is Debian 10 amd64
(binutils 2.31.1, if that matters).

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

* [Bug debug/100725] dwarf error with --whole-program
  2021-05-22 14:37 [Bug debug/100725] New: dwarf error with --whole-program fx at gnu dot org
@ 2021-05-23 11:12 ` jakub at gcc dot gnu.org
  2021-05-24 10:36 ` fx at gnu dot org
  2021-05-25  7:19 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-23 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Those binutils are too old for dwarf5.
When the linker doesn't print any diagnostics, that isn't a big deal, but if it
needs to diagnose something and parse DWARF for that, you need 2.35 or later.

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

* [Bug debug/100725] dwarf error with --whole-program
  2021-05-22 14:37 [Bug debug/100725] New: dwarf error with --whole-program fx at gnu dot org
  2021-05-23 11:12 ` [Bug debug/100725] " jakub at gcc dot gnu.org
@ 2021-05-24 10:36 ` fx at gnu dot org
  2021-05-25  7:19 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: fx at gnu dot org @ 2021-05-24 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Dave Love <fx at gnu dot org> ---
(In reply to Jakub Jelinek from comment #1)
> Those binutils are too old for dwarf5.
> When the linker doesn't print any diagnostics, that isn't a big deal, but if
> it needs to diagnose something and parse DWARF for that, you need 2.35 or
> later.

Does that mean you can't reasonably use 11 on most distributions without
explicitly using -gdwarf-4?  The release notes suggested to me it would still
work, just not with full functionality somehow, and there is some adjustment
for the binutils version.  Is there some way to configure it to default to
DWARF 4 other than, I guess, adding specs to treat -g as -gdwarf-4?

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

* [Bug debug/100725] dwarf error with --whole-program
  2021-05-22 14:37 [Bug debug/100725] New: dwarf error with --whole-program fx at gnu dot org
  2021-05-23 11:12 ` [Bug debug/100725] " jakub at gcc dot gnu.org
  2021-05-24 10:36 ` fx at gnu dot org
@ 2021-05-25  7:19 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-25  7:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Dave Love from comment #2)
> (In reply to Jakub Jelinek from comment #1)
> > Those binutils are too old for dwarf5.
> > When the linker doesn't print any diagnostics, that isn't a big deal, but if
> > it needs to diagnose something and parse DWARF for that, you need 2.35 or
> > later.
> 
> Does that mean you can't reasonably use 11 on most distributions without
> explicitly using -gdwarf-4?  The release notes suggested to me it would
> still work, just not with full functionality somehow, and there is some
> adjustment for the binutils version.  Is there some way to configure it to
> default to DWARF 4 other than, I guess, adding specs to treat -g as
> -gdwarf-4?

Yes, on older distributions SUSE patches GCC 11 to default to -gdwarf-4.

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

end of thread, other threads:[~2021-05-25  7:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-22 14:37 [Bug debug/100725] New: dwarf error with --whole-program fx at gnu dot org
2021-05-23 11:12 ` [Bug debug/100725] " jakub at gcc dot gnu.org
2021-05-24 10:36 ` fx at gnu dot org
2021-05-25  7:19 ` rguenth at gcc dot gnu.org

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