Bug 27375

Summary: [dwz, dwarf5] .debug_addr support
Product: dwz Reporter: Tom de Vries <vries>
Component: defaultAssignee: Nobody <nobody>
Status: NEW ---    
Severity: enhancement CC: costamagnagianfranco, dwz, glaubitz, jordan, m.k, mark, martin.liska, tuliom
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Project(s) to access: ssh public key:
Bug Depends on:    
Bug Blocks: 24726    

Description Tom de Vries 2021-02-08 13:32:16 UTC
[ Not a duplicate of PR24756, that one is related to split dwarf.  There will be overlap though. ]

$ clang -gdwarf-5 ../src/testsuite/dwz.tests/hello.c 
$ cp a.out 1; ./dwz 1
./dwz: 1: Unknown debugging section .debug_addr
Comment 1 Mark Wielaard 2021-02-18 14:45:36 UTC
Also note that there are two new location operations DW_OP_addrx and DW_OP_constx that can reference the .debug_addr section index.
Comment 2 Gianfranco 2022-09-22 06:37:11 UTC
https://sourceware.org/pipermail/dwz/2021q1/000930.html contains a patch for this issue.

and my bug https://sourceware.org/bugzilla/show_bug.cgi?id=28985 is duplicate of this one.
Comment 3 Gianfranco 2022-09-22 14:47:34 UTC
*** Bug 28985 has been marked as a duplicate of this bug. ***
Comment 4 Mark Wielaard 2024-05-10 12:24:48 UTC
(In reply to Gianfranco from comment #2)
> https://sourceware.org/pipermail/dwz/2021q1/000930.html contains a patch for
> this issue.

Note that patch has been integrated and is in release but doesn't handle .debug_addr.

There is a patch that does here:
https://inbox.sourceware.org/dwz/CH0PR12MB52659E9758818EBFDFE85EA8962E9@CH0PR12MB5265.namprd12.prod.outlook.com/
Comment 5 Marek Küthe 2025-12-15 00:39:04 UTC
Hello,

I hope I'm not bothering you too much, but I wanted to ask what the current status is? I would like to try building a Debian package with clang, but this doesn't seem to work due to this error:
```
Installing /woodpecker/src/codeberg.org/********/mping-sender/systemd/mping-sender.service to /woodpecker/src/codeberg.org/********/mping-sender/debian/mping-sender/usr/lib/systemd/system
Installing /woodpecker/src/codeberg.org/********/mping-sender/systemd/mping-sender to /woodpecker/src/codeberg.org/********/mping-sender/debian/mping-sender/etc/default
Installing /woodpecker/src/codeberg.org/********/mping-sender/apparmor/usr.bin.mping-sender to /woodpecker/src/codeberg.org/********/mping-sender/debian/mping-sender/etc/apparmor.d
make[2]: Leaving directory '/woodpecker/src/codeberg.org/********/mping-sender'
   dh_installdocs
   dh_installchangelogs
   dh_installsystemd
   dh_perl
   dh_link
   dh_strip_nondeterminism
   dh_compress
   dh_fixperms
   dh_missing
   dh_dwz -a
dwz: debian/mping-sender/usr/bin/mping-sender: Unknown debugging section .debug_addr
dh_dwz: error: dwz -- debian/mping-sender/usr/bin/mping-sender returned exit code 1
dh_dwz: error: Aborting due to earlier error
make[1]: *** [debian/rules:8: binary] Error 25
make[1]: Leaving directory '/woodpecker/src/codeberg.org/********/mping-sender'
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make: *** [Makefile:34: debian] Error 2
```
CI: https://ci.codeberg.org/repos/15696/pipeline/58/3

As a workaround, I currently have the following in my meson.build:
```
if get_option('debug')
    # see https://sourceware.org/bugzilla/show_bug.cgi?id=27375
    add_project_arguments(cpp_compiler.get_supported_arguments(['-gdwarf-4']), language: 'cpp')
endif
```
Comment 6 Mark Wielaard 2025-12-15 09:31:50 UTC
(In reply to Marek Küthe from comment #5)
> I hope I'm not bothering you too much, but I wanted to ask what the current
> status is? I would like to try building a Debian package with clang, but
> this doesn't seem to work due to this error:

Sorry, there hasn't been much progress here even though it isn't too hard to support. The issue has been that the tests don't use binutils readelf but some other dwarf dump tool. I believe at the time binutils readelf also didn't handle .debug_addr. But it does now.

Note that this really shouldn't be a hard failure in the debian tooling. If dwz fails it just means it couldn't compress and didn't write out new debug data.