Index: lld/ELF/MapFile.cpp =================================================================== --- lld/ELF/MapFile.cpp +++ lld/ELF/MapFile.cpp @@ -138,6 +138,21 @@ // Dump symbols for each input section. for (InputSection *IS : getInputSections(OSec)) { + if (IS == InX::EhFrame) { + auto Print = [&](const EhSectionPiece *P) { + writeHeader(OS, OSec->Addr + P->OutputOff, P->Size, 0); + OS << indent(1) << toString(P->Sec->File) << ":(" << P->Sec->Name + << "+0x" << Twine::utohexstr(P->InputOff) + ")\n"; + }; + + for (const CieRecord *Rec : InX::EhFrame->getCieRecords()) { + Print(Rec->Cie); + for (const EhSectionPiece *Fde : Rec->Fdes) + Print(Fde); + } + continue; + } + writeHeader(OS, OSec->Addr + IS->OutSecOff, IS->getSize(), IS->Alignment); OS << indent(1) << toString(IS) << '\n'; for (Symbol *Sym : SectionSyms[IS]) Index: lld/ELF/SyntheticSections.h =================================================================== --- lld/ELF/SyntheticSections.h +++ lld/ELF/SyntheticSections.h @@ -83,6 +83,7 @@ }; std::vector getFdeData() const; + ArrayRef getCieRecords() const { return CieRecords; } private: uint64_t Size = 0; Index: lld/test/ELF/Inputs/map-file2.s =================================================================== --- lld/test/ELF/Inputs/map-file2.s +++ lld/test/ELF/Inputs/map-file2.s @@ -1,5 +1,7 @@ foo: +.cfi_startproc nop +.cfi_endproc .global bar bar: nop Index: lld/test/ELF/map-file.s =================================================================== --- lld/test/ELF/map-file.s +++ lld/test/ELF/map-file.s @@ -15,6 +15,8 @@ .global _start _start: +.cfi_startproc +.cfi_endproc .quad sharedFoo .quad sharedBar .byte 0xe8 @@ -26,8 +28,8 @@ .global _Z1fi _Z1fi: .cfi_startproc -.cfi_endproc nop +.cfi_endproc .weak bar bar: .long bar - . @@ -51,8 +53,11 @@ // CHECK-NEXT: 00000000002002d0 0000000000000030 8 :(.rela.dyn) // CHECK-NEXT: 0000000000200300 0000000000000030 8 .rela.plt // CHECK-NEXT: 0000000000200300 0000000000000030 8 :(.rela.plt) -// CHECK-NEXT: 0000000000200330 0000000000000030 8 .eh_frame -// CHECK-NEXT: 0000000000200330 0000000000000030 8 :(.eh_frame) +// CHECK-NEXT: 0000000000200330 0000000000000060 8 .eh_frame +// CHECK-NEXT: 0000000000200330 0000000000000018 0 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x0) +// CHECK-NEXT: 0000000000200348 0000000000000014 0 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x18) +// CHECK-NEXT: 0000000000200360 0000000000000014 0 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x2c) +// CHECK-NEXT: 0000000000200378 0000000000000018 0 {{.*}}{{/|\\}}map-file.s.tmp2.o:(.eh_frame+0x18) // CHECK-NEXT: 0000000000201000 000000000000002d 4 .text // CHECK-NEXT: 0000000000201000 0000000000000028 4 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.text) // CHECK-NEXT: 0000000000201000 0000000000000000 0 _start