bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/29451] gas-2.39 started adding 0-sized DIEs to functions withou


From: slyich at gmail dot com
Subject: [Bug gas/29451] gas-2.39 started adding 0-sized DIEs to functions without .size
Date: Mon, 08 Aug 2022 15:52:00 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29451

--- Comment #4 from Sergei Trofimovich <slyich at gmail dot com> ---
(In reply to Nick Clifton from comment #3)
> (In reply to Sergei Trofimovich from comment #0)
> 
> >     <28>   DW_AT_low_pc      : (addr) 0x0
> >     <2c>   DW_AT_high_pc     : (addr) 0x0
> 
> > Would it be fair to say it's a bug to assign zero size here via DW_AT_low_pc
> > / DW_AT_high_pc?
> 
> Actually it *is* fair to give them 0 values.  (The values are addresses, not
> sizes).  The reason is that the address of the start and end of the
> __x86.get_pc_thunk.bx function has not been assigned yet.  (This is an
> object file, not a fully linked executable).
> 
> If you look at the relocations for the crti.o file you find:
> 
>   Relocation section '.rel.debug_info' at offset 0x288 contains 12 entries:
>    Offset     Info    Type                Sym. Value  Symbol's Name
>    [...]
>   00000036  00000901 R_386_32               00000000   __x86.get_pc_thunk.bx
>   0000003a  00000901 R_386_32               00000000   __x86.get_pc_thunk.bx
> 
> So when this file is linked in with object files and these relocations are
> resolved the correct values for the __x86.get_pc_thunk.bx symbol will be
> installed into the .debug_info section, and everything should work.

In https://sourceware.org/PR29450 we observed zero-size on a final executable.
Is zero a reasonable value here? `__x86.get_pc_thunk.bx` lives in a separate
section compared to `_init`.

Nick, are you sure you are looking at the `_init` debug relocations and not
`__x86.get_pc_thunk.bx`? I think both are present and are slightly different.

Looking at the specific offsets:

$ readelf -aW --debug-dump crti.o
...
Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:        0x3b (32-bit)
   Version:       2
   Abbrev Offset: 0x0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_stmt_list   : (data4) 0x0
    <10>   DW_AT_ranges      : (data4) 0x0
    <14>   DW_AT_name        : (strp) (offset: 0x0): crti.S.S
    <18>   DW_AT_comp_dir    : (strp) (offset: 0x9): /tmp
    <1c>   DW_AT_producer    : (strp) (offset: 0xe): GNU AS 2.39
    <20>   DW_AT_language    : (data2) 32769    (MIPS assembler)
 <1><22>: Abbrev Number: 2 (DW_TAG_subprogram)
    <23>   DW_AT_name        : (strp) (offset: 0x1a): _init
    <27>   DW_AT_external    : (flag) 1
    <28>   DW_AT_low_pc      : (addr) 0x0 ; <<<---
    <2c>   DW_AT_high_pc     : (addr) 0x0 ; <<<---
...

The concern is `DW_AT_low_pc / DW_AT_high_pc` at 0x28/0xac.

$ objdump -Dr crti.o

00000000 <.debug_info>:
...
  26:   00 01                   add    %al,(%ecx)
        ...
                        28: R_386_32    _init ; <<<---
                        2c: R_386_32    _init ; <<<---
  30:   02 20                   add    (%eax),%ah

These are DW_AT_low_pc=_init, DW_AT_high_pc=_init. AFAIU DW_AT_high_pc should
be somehting like _init+2 to at least account for `ud2`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]