Skip to content

Running build with -emit-bc & -lto=llvm-full results in invalid dSYM with error invalid DIE reference <some-ref>. Offset is in between DIEs #82089

Open
@sanju-naik

Description

@sanju-naik

Description

Issue

I am running a build with -emit-bc & -lto=llvm-full swift compiler flags to reduce app size but this results in Invalid dSYM.
Running dwarfdump --verify //path-to.dSYM shows error: invalid DIE reference <some-ref>. Offset is in between DIEs: This is on Xcode 16.3

Reproduction

Attaching repro project - BazelDemoHelloWorld (1).zip

- Download the attachment and unzip
- Open BazelDemoHelloWorld.xcodeproj 
- Select BazelDemoHelloWorld scheme from Xcode's selector and hit build or run, it would produce artifacts in DerivedData

 - then run `dwarfdump --verify` on the generated dSYM in the derived Data. Adding one of the complete errors from the attached sample. 
Verifying unit: 30 / 205, "lottie-ios/Sources/Private/CoreAnimation/Layers/PreCompLayer.swift"
error: invalid DIE reference 0x0005d67f. Offset is in between DIEs:

0x0005dfdf: DW_TAG_subprogram [49]   (0x0005d6b6)
              DW_AT_linkage_name [DW_FORM_strp]	( .debug_str[0x0009abac] = "$sSa11_getElement_20wasNativeTypeChecked22matchingSubscriptCheckxSi_Sbs16_DependenceTokenVtF6Lottie14ShapeItemLayerC0N0V_Tg5")
              DW_AT_type [DW_FORM_ref4]	(cu + 0x0000 => {0x0005d67f})
              DW_AT_artificial [DW_FORM_flag_present]	(true)
              DW_AT_APPLE_optimized [DW_FORM_flag_present]	(true)
              DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)


0x0005e149: DW_TAG_subprogram [38]   (0x0005e060)
              DW_AT_linkage_name [DW_FORM_strp]	( .debug_str[0x0009af88] = "$sSayxSicig6Lottie14ShapeItemLayerC0C0V_Tg5")
              DW_AT_name [DW_FORM_strp]	( .debug_str[0x000050bd] = "subscript.get")
              DW_AT_type [DW_FORM_ref4]	(cu + 0x0000 => {0x0005d67f})
              DW_AT_APPLE_optimized [DW_FORM_flag_present]	(true)
              DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)

Expected behavior

Build should produce valid dSYM and Running dwarfdump --verify shouldn't show any errors.

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

And Xcode 16.3

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions