Skip to content

[llvm][DWARFLinker] Don't attach DW_AT_dwo_id to CUs #105186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,12 @@ unsigned DWARFLinker::DIECloner::cloneScalarAttribute(
unsigned AttrSize, AttributesInfo &Info) {
uint64_t Value;

// We don't emit any skeleton CUs with dsymutil. So avoid emitting
// a redundant DW_AT_GNU_dwo_id on the non-skeleton CU.
if (AttrSpec.Attr == dwarf::DW_AT_GNU_dwo_id ||
AttrSpec.Attr == dwarf::DW_AT_dwo_id)
return 0;

// Check for the offset to the macro table. If offset is incorrect then we
// need to remove the attribute.
if (AttrSpec.Attr == dwarf::DW_AT_macro_info) {
Expand Down
12 changes: 8 additions & 4 deletions llvm/test/tools/dsymutil/X86/modules.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifdef BAR_H
// ---------------------------------------------------------------------
// CHECK: DW_TAG_compile_unit
// CHECK-NOT: DW_AT_GNU_dwo_id
// CHECK-NOT: DW_TAG
// CHECK: DW_TAG_module
// CHECK-NEXT: DW_AT_name{{.*}}"Bar"
Expand All @@ -55,6 +56,7 @@
#ifdef FOO_H
// ---------------------------------------------------------------------
// CHECK: DW_TAG_compile_unit
// CHECK-NOT: DW_AT_GNU_dwo_id
// CHECK-NOT: DW_TAG
// CHECK: 0x0[[FOO:.*]]: DW_TAG_module
// CHECK-NEXT: DW_AT_name{{.*}}"Foo"
Expand Down Expand Up @@ -92,8 +94,9 @@ @interface Foo {
#else
// ---------------------------------------------------------------------

// CHECK: DW_TAG_compile_unit
// CHECK: DW_AT_low_pc
// CHECK: DW_TAG_compile_unit
// CHECK-NOT: DW_AT_GNU_dwo_id
// CHECK: DW_AT_low_pc
// CHECK-NOT: DW_TAG_module
// CHECK-NOT: DW_TAG_typedef
//
Expand Down Expand Up @@ -130,8 +133,9 @@ int main(int argc, char **argv) {
#endif
#endif

// CHECK: DW_TAG_compile_unit
// CHECK: DW_AT_name {{.*}}"odr_violation.c"
// CHECK: DW_TAG_compile_unit
// CHECK-NOT: DW_AT_GNU_dwo_id
// CHECK: DW_AT_name {{.*}}"odr_violation.c"
// CHECK: DW_TAG_variable
// CHECK: DW_AT_name {{.*}}"odr_violation"
// CHECK: DW_AT_type [DW_FORM_ref4] ({{.*}}{0x{{0*}}[[BAR2:.*]]}
Expand Down
Loading