public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/28191] New: DWARF5 .debug_addr support
@ 2021-08-04 16:41 gprocida at google dot com
  2021-08-05 12:21 ` [Bug default/28191] " gprocida at google dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gprocida at google dot com @ 2021-08-04 16:41 UTC (permalink / raw)
  To: libabigail

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

            Bug ID: 28191
           Summary: DWARF5 .debug_addr support
           Product: libabigail
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: default
          Assignee: dodji at redhat dot com
          Reporter: gprocida at google dot com
                CC: libabigail at sourceware dot org
  Target Milestone: ---

libabigail doesn't know about .debug_addr and DW_OP_addrx.

The result is that symbols (silently) end up with no type information.

This is a blocker for migrating the Android kernel to DWARF 5 and is already
affecting ABI monitoring of Android userspace libraries.

Test case:

$ cat foo.c
int x = 1;
$ clang-11 -gdwarf-4 -c foo.c 
$ abidw foo.o
<abi-corpus version='2.0' path='foo.o' architecture='elf-amd-x86_64'>
  <elf-variable-symbols>
    <elf-symbol name='x' size='4' type='object-type' binding='global-binding'
visibility='default-visibility' is-defined='yes'/>
  </elf-variable-symbols>
  <abi-instr address-size='64' path='foo.c'
comp-dir-path='/usr/local/google/home/gprocida/dev/libabigail/b195152239'
language='LANG_C99'>
    <type-decl name='int' size-in-bits='32' id='type-id-1'/>
    <var-decl name='x' type-id='type-id-1' mangled-name='x'
visibility='default'
filepath='/usr/local/google/home/gprocida/dev/libabigail/b1
95152239/foo.c' line='1' column='1' elf-symbol-id='x'/>
  </abi-instr>
</abi-corpus>
$ clang-11 -gdwarf-5 -c foo.c 
$ abidw foo.o
<abi-corpus version='2.0' path='foo.o' architecture='elf-amd-x86_64'>
  <elf-variable-symbols>
    <elf-symbol name='x' size='4' type='object-type' binding='global-binding'
visibility='default-visibility' is-defined='yes'/>
  </elf-variable-symbols>
</abi-corpus>

dwarfdump snippets:

< 1><0x0000001e>    DW_TAG_variable
                      DW_AT_name                  x
                      DW_AT_type                  <0x00000033>
                      DW_AT_external              yes(1)
                      DW_AT_decl_file             0x00000001
/usr/local/google/home/gprocida/dev/libabigail/b195152239/foo.c
                      DW_AT_decl_line             0x00000001
                      DW_AT_location              len 0x0009:
0x030000000000000000: 
                          DW_OP_addr 0x00000000

< 1><0x0000001e>    DW_TAG_variable
                      DW_AT_name                  (indexed string: 0x00000003)x
                      DW_AT_type                  <0x00000029>
                      DW_AT_external              yes(1)
                      DW_AT_decl_file             0x00000000
/usr/local/google/home/gprocida/dev/libabigail/b195152239/foo.c
                      DW_AT_decl_line             0x00000001
                      DW_AT_location              len 0x0002: 0xa100: 
                          DW_OP_addrx 0

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
@ 2021-08-05 12:21 ` gprocida at google dot com
  2021-08-11 12:06 ` gprocida at google dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gprocida at google dot com @ 2021-08-05 12:21 UTC (permalink / raw)
  To: libabigail

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

--- Comment #1 from gprocida at google dot com ---
eu-readelf -W -S

DWARF 4

There are 13 section headers, starting at offset 0x330:

Section Headers:
[Nr] Name                 Type         Addr             Off      Size     ES
Flags Lk Inf Al
[ 0]                      NULL         0000000000000000 00000000 00000000  0   
    0   0  0
[ 1] .strtab              STRTAB       0000000000000000 000002a8 00000082  0   
    0   0  1
[ 2] .text                PROGBITS     0000000000000000 00000040 00000000  0 AX
    0   0  4
[ 3] .data                PROGBITS     0000000000000000 00000040 00000004  0 WA
    0   0  4
[ 4] .debug_abbrev        PROGBITS     0000000000000000 00000044 0000002c  0   
    0   0  1
[ 5] .debug_info          PROGBITS     0000000000000000 00000070 0000003b  0   
    0   0  1
[ 6] .rela.debug_info     RELA         0000000000000000 000001e8 000000c0 24   
   12   5  8
[ 7] .debug_str           PROGBITS     0000000000000000 000000ab 00000064  1 MS
    0   0  1
[ 8] .comment             PROGBITS     0000000000000000 0000010f 0000001f  1 MS
    0   0  1
[ 9] .note.GNU-stack      PROGBITS     0000000000000000 0000012e 00000000  0   
    0   0  1
[10] .debug_line          PROGBITS     0000000000000000 0000012e 00000027  0   
    0   0  1
[11] .llvm_addrsig        SHT_LOOS+fff4c03 0000000000000000 000002a8 00000000 
0 E     12   0  1
[12] .symtab              SYMTAB       0000000000000000 00000158 00000090 24   
    1   5  8

DWARF 5

There are 19 section headers, starting at offset 0x490:

Section Headers:
[Nr] Name                 Type         Addr             Off      Size     ES
Flags Lk Inf Al
[ 0]                      NULL         0000000000000000 00000000 00000000  0   
    0   0  0
[ 1] .strtab              STRTAB       0000000000000000 000003d0 000000c0  0   
    0   0  1
[ 2] .text                PROGBITS     0000000000000000 00000040 00000000  0 AX
    0   0  4
[ 3] .data                PROGBITS     0000000000000000 00000040 00000004  0 WA
    0   0  4
[ 4] .debug_abbrev        PROGBITS     0000000000000000 00000044 00000030  0   
    0   0  1
[ 5] .debug_info          PROGBITS     0000000000000000 00000074 0000002e  0   
    0   0  1
[ 6] .rela.debug_info     RELA         0000000000000000 000002b0 00000060 24   
   18   5  8
[ 7] .debug_str_offsets   PROGBITS     0000000000000000 000000a2 0000001c  0   
    0   0  1
[ 8] .rela.debug_str_offsets RELA         0000000000000000 00000310 00000078 24
      18   7  8
[ 9] .debug_str           PROGBITS     0000000000000000 000000be 00000064  1 MS
    0   0  1
[10] .debug_addr          PROGBITS     0000000000000000 00000122 00000010  0   
    0   0  1
[11] .rela.debug_addr     RELA         0000000000000000 00000388 00000018 24   
   18  10  8
[12] .comment             PROGBITS     0000000000000000 00000132 0000001f  1 MS
    0   0  1
[13] .note.GNU-stack      PROGBITS     0000000000000000 00000151 00000000  0   
    0   0  1
[14] .debug_line          PROGBITS     0000000000000000 00000151 00000043  0   
    0   0  1
[15] .rela.debug_line     RELA         0000000000000000 000003a0 00000030 24   
   18  14  8
[16] .debug_line_str      PROGBITS     0000000000000000 00000194 00000040  1 MS
    0   0  1
[17] .llvm_addrsig        SHT_LOOS+fff4c03 0000000000000000 000003d0 00000000 
0 E     18   0  1
[18] .symtab              SYMTAB       0000000000000000 000001d8 000000d8 24   
    1   8  8

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
  2021-08-05 12:21 ` [Bug default/28191] " gprocida at google dot com
@ 2021-08-11 12:06 ` gprocida at google dot com
  2021-09-12 19:45 ` mark at klomp dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gprocida at google dot com @ 2021-08-11 12:06 UTC (permalink / raw)
  To: libabigail

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

gprocida at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |28220


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=28220
[Bug 28220] dwarf_location_attr returns high-bit junk from .debug_addr when
fetching 32-bit addresses
-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
  2021-08-05 12:21 ` [Bug default/28191] " gprocida at google dot com
  2021-08-11 12:06 ` gprocida at google dot com
@ 2021-09-12 19:45 ` mark at klomp dot org
  2021-11-19 14:37 ` gprocida at google dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2021-09-12 19:45 UTC (permalink / raw)
  To: libabigail

https://sourceware.org/bugzilla/show_bug.cgi?id=28191
Bug 28191 depends on bug 28220, which changed state.

Bug 28220 Summary: dwarf_location_attr returns high-bit junk from .debug_addr when fetching 32-bit addresses
https://sourceware.org/bugzilla/show_bug.cgi?id=28220

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
                   ` (2 preceding siblings ...)
  2021-09-12 19:45 ` mark at klomp dot org
@ 2021-11-19 14:37 ` gprocida at google dot com
  2021-11-22 13:51 ` maennich at android dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gprocida at google dot com @ 2021-11-19 14:37 UTC (permalink / raw)
  To: libabigail

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

--- Comment #2 from gprocida at google dot com ---
Elfutils 0.186 contains a libdw fix.

The fix plus a DWARF reader patch I wrote resolve this bug.

I'll repost the patch with updated tests etc.

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
                   ` (3 preceding siblings ...)
  2021-11-19 14:37 ` gprocida at google dot com
@ 2021-11-22 13:51 ` maennich at android dot com
  2022-01-13  8:52 ` gprocida at google dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: maennich at android dot com @ 2021-11-22 13:51 UTC (permalink / raw)
  To: libabigail

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

Matthias Maennich <maennich at android dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maennich at android dot com

--- Comment #3 from Matthias Maennich <maennich at android dot com> ---
FTR, the updated fix was posted at
https://sourceware.org/pipermail/libabigail/2021q4/003870.html

Not sure how we do require a certain elfutils version though. But given we are
dealing with a new-ish dwarf standard, we probably can also require a new-ish
toolchain.

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
                   ` (4 preceding siblings ...)
  2021-11-22 13:51 ` maennich at android dot com
@ 2022-01-13  8:52 ` gprocida at google dot com
  2022-01-17 13:08 ` dodji at redhat dot com
  2022-01-17 13:16 ` gprocida at google dot com
  7 siblings, 0 replies; 9+ messages in thread
From: gprocida at google dot com @ 2022-01-13  8:52 UTC (permalink / raw)
  To: libabigail

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

--- Comment #4 from gprocida at google dot com ---
There was some discussion on the mailing list.

I think the conclusion was that while this patch does improve address
interpretation, it cannot be extended to replace libabigail's mini-interpreter
altogether as libdw doesn't expose the necessary functionality.

I will repost a rebased patch. Please apply it if you're happy with it.

Thanks!

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
                   ` (5 preceding siblings ...)
  2022-01-13  8:52 ` gprocida at google dot com
@ 2022-01-17 13:08 ` dodji at redhat dot com
  2022-01-17 13:16 ` gprocida at google dot com
  7 siblings, 0 replies; 9+ messages in thread
From: dodji at redhat dot com @ 2022-01-17 13:08 UTC (permalink / raw)
  To: libabigail

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

--- Comment #5 from dodji at redhat dot com ---
(In reply to gprocida from comment #4)
> There was some discussion on the mailing list.
> 
> I think the conclusion was that while this patch does improve address
> interpretation, it cannot be extended to replace libabigail's
> mini-interpreter altogether as libdw doesn't expose the necessary
> functionality.
> 
> I will repost a rebased patch. Please apply it if you're happy with it.


I have applied it at
https://sourceware.org/git/?p=libabigail.git;a=commit;h=16207c4af7bc2510ba5d996b8dbdecda30d15200.

Please feel free to close this issue it's fixed for you.

Thanks!

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

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

* [Bug default/28191] DWARF5 .debug_addr support
  2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
                   ` (6 preceding siblings ...)
  2022-01-17 13:08 ` dodji at redhat dot com
@ 2022-01-17 13:16 ` gprocida at google dot com
  7 siblings, 0 replies; 9+ messages in thread
From: gprocida at google dot com @ 2022-01-17 13:16 UTC (permalink / raw)
  To: libabigail

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

gprocida at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from gprocida at google dot com ---
This fixes the issue we saw.

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

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

end of thread, other threads:[~2022-01-17 13:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 16:41 [Bug default/28191] New: DWARF5 .debug_addr support gprocida at google dot com
2021-08-05 12:21 ` [Bug default/28191] " gprocida at google dot com
2021-08-11 12:06 ` gprocida at google dot com
2021-09-12 19:45 ` mark at klomp dot org
2021-11-19 14:37 ` gprocida at google dot com
2021-11-22 13:51 ` maennich at android dot com
2022-01-13  8:52 ` gprocida at google dot com
2022-01-17 13:08 ` dodji at redhat dot com
2022-01-17 13:16 ` gprocida at google 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).