Bug 27572 - Multifile drops DW_TAG_namespace::DW_AT_export_symbols
Summary: Multifile drops DW_TAG_namespace::DW_AT_export_symbols
Status: NEW
Alias: None
Product: dwz
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 critical
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 24726
  Show dependency treegraph
 
Reported: 2021-03-12 17:13 UTC by Jan Kratochvil
Modified: 2021-03-12 19:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2021-03-12 17:13:34 UTC
echo 'inline namespace A { enum E { X0,X1,X2,X3,X4,X5 }; } int main() { return X0; }'|g++ -Wall -g -x c++ -;cp -p a.out a.out.dup;dwz -m a.out.dwz a.out a.out.dup;readelf -wi a.out.dwz|grep DW_AT_export_symbols

Actual:
(nothing)

Expected:
    <XX>   DW_AT_export_symbols: 1

Context:
a.out:
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
...
 <1><22>: Abbrev Number: 5 (DW_TAG_imported_unit)
    <23>   DW_AT_import      : <alt 0xb>
 <1><27>: Abbrev Number: 4 (DW_TAG_namespace)
    <28>   DW_AT_name        : A
...
    <2d>   DW_AT_export_symbols: 1
 <2><2e>: Abbrev Number: 0

a.out.dwz:
 <0><b>: Abbrev Number: 4 (DW_TAG_partial_unit)
...
 <1><14>: Abbrev Number: 2 (DW_TAG_namespace)
    <15>   DW_AT_name        : A
...
 <2><18>: Abbrev Number: 6 (DW_TAG_enumeration_type)

This breaks libc++ which is using namespace 'std::__1::' -> 'std::'
Comment 1 Mark Wielaard 2021-03-12 18:02:46 UTC
Yes, the code assumes the only relevant attribute of a DW_TAG_namespace is the DW_AT_name. This is both in the build_abbrevs_for_die, write_die and partition_dups_1 functions. It only allows for an optional DW_AT_sibling attribute. It should carry over the DW_AT_export_symbols (which is new in DWARF5).