Hi,

On Wed, 2020-07-29 at 17:18 +0100, Richard W.M. Jones wrote:
> (Adding OCaml author)

(Adding binutils/gas maintainer)

> On Wed, Jul 29, 2020 at 05:54:52PM +0200, Mark Wielaard wrote:
> > On Wed, 2020-07-29 at 16:07 +0100, Richard W.M. Jones wrote:
> I should probably add that I'm building these on my local machine
> which isn't completely updated to Rawhide.  I'm not sure whether or
> not that will make a difference - I'm assuming _not_ for what the
> OCaml compiler generates (since I'm running the latest of that), but
> not sure about the rest of the toolchain.  I'm using
> binutils-2.34-3.fc32.x86_64.

Right. Same here. Dunno why mockbuild didn't pick up the 2.35 version,
but I think the bug is in that one. See below.

> > > I also saved an asm file from one of them which may be helpful:
> > > 
> > > http://oirase.annexia.org/tmp/hacha.s
> > 
> > So ml depends on binutils gas to generate the actual debuginfo.
> > I assume it gets called with: as -g
> > Is there a way to see how exactly gas is called (with which arguments)?
> 
> In fact it *isn't* passing -g to as:
> 
> $ /usr/bin/ocamlopt.opt -c -w +a-3-4-9-41-45-67 -g -annot -safe-string -o 
> hacha.cmx hacha.ml -S -verbose
> + as  -o 'hacha.o' 'hacha.s'
> 
> Is this a problem?  I sort of assumed that as would have nothing to do
> with generating debug information, beyond what is contained explicitly
> in the .s file itself.

Yes, I think we have a winner!
gas generates a tiny bit of debuginfo even if you don't supply -g.

But... in 2.35 you can give the DWARF level you want.
The problem with not supplying -g (or --gdwarf-[VERSION]) is that the
dwarf_level is never set! And then gas will happily create an
.debug_info section with DWARF CUs that have a version of zero (!).

This, defaulting to version 4. Fixes it for me:

diff --git a/gas/as.c b/gas/as.c
index 4c5881abd88..c2da78870ef 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -103,7 +103,7 @@ int verbose = 0;
 int flag_dwarf_cie_version = -1;
 
 /* The maximum level of DWARF DEBUG information we should manufacture.  */
-unsigned int dwarf_level = 0;
+unsigned int dwarf_level = 4;
 
 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
 int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON;
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to