[lld] 7f07799 - [lld-macho] Emit map file entry for compact unwind info
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 8 13:34:21 PST 2022
Author: Jez Ng
Date: 2022-11-08T16:33:28-05:00
New Revision: 7f0779967f0690482c2cef70fc49e1381d32af1e
URL: https://github.com/llvm/llvm-project/commit/7f0779967f0690482c2cef70fc49e1381d32af1e
DIFF: https://github.com/llvm/llvm-project/commit/7f0779967f0690482c2cef70fc49e1381d32af1e.diff
LOG: [lld-macho] Emit map file entry for compact unwind info
Just like ld64 does.
Reviewed By: #lld-macho, Roger
Differential Revision: https://reviews.llvm.org/D137369
Added:
Modified:
lld/MachO/MapFile.cpp
lld/test/MachO/map-file.s
Removed:
################################################################################
diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp
index 5d6c87baba9f..8f195586ff1c 100644
--- a/lld/MachO/MapFile.cpp
+++ b/lld/MachO/MapFile.cpp
@@ -182,6 +182,9 @@ void macho::writeMapFile() {
info.fileIndex);
os.write_escaped(info.str) << "\n";
}
+ } else if (osec == (void *)in.unwindInfo) {
+ os << format("0x%08llX\t0x%08llX\t[ 0] compact unwind info\n",
+ osec->addr, osec->getSize());
}
// TODO print other synthetic sections
}
diff --git a/lld/test/MachO/map-file.s b/lld/test/MachO/map-file.s
index fe1ef88604e1..008bad23fd33 100644
--- a/lld/test/MachO/map-file.s
+++ b/lld/test/MachO/map-file.s
@@ -15,7 +15,9 @@
# CHECK-NEXT: Idx Name Size VMA Type
# CHECK-NEXT: 0 __text {{[0-9a-f]+}} [[#%x,TEXT:]] TEXT
# CHECK-NEXT: 1 __cstring {{[0-9a-f]+}} [[#%x,CSTR:]] DATA
-# CHECK-NEXT: 2 __common {{[0-9a-f]+}} [[#%x,BSS:]] BSS
+# CHECK-NEXT: 2 __unwind_info {{[0-9a-f]+}} [[#%x,UNWIND:]] DATA
+# CHECK-NEXT: 3 __eh_frame {{[0-9a-f]+}} [[#%x,EH_FRAME:]] DATA
+# CHECK-NEXT: 4 __common {{[0-9a-f]+}} [[#%x,BSS:]] BSS
# CHECK: SYMBOL TABLE:
# CHECK-DAG: [[#%x,MAIN:]] g F __TEXT,__text _main
@@ -34,10 +36,12 @@
# CHECK-NEXT: [ 3] {{.*}}{{/|\\}}map-file.s.tmp/c-string-literal.o
# CHECK-NEXT: # Sections:
-# CHECK-NEXT: # Address Size Segment Section
-# CHECK-NEXT: 0x[[#%X,TEXT]] 0x{{[0-9A-F]+}} __TEXT __text
-# CHECK-NEXT: 0x[[#%X,CSTR]] 0x{{[0-9A-F]+}} __TEXT __cstring
-# CHECK-NEXT: 0x[[#%X,BSS]] 0x{{[0-9A-F]+}} __DATA __common
+# CHECK-NEXT: # Address Size Segment Section
+# CHECK-NEXT: 0x[[#%X,TEXT]] 0x{{[0-9A-F]+}} __TEXT __text
+# CHECK-NEXT: 0x[[#%X,CSTR]] 0x{{[0-9A-F]+}} __TEXT __cstring
+# CHECK-NEXT: 0x[[#%X,UNWIND]] 0x{{[0-9A-F]+}} __TEXT __unwind_info
+# CHECK-NEXT: 0x[[#%X,EH_FRAME]] 0x{{[0-9A-F]+}} __TEXT __eh_frame
+# CHECK-NEXT: 0x[[#%X,BSS]] 0x{{[0-9A-F]+}} __DATA __common
# CHECK-NEXT: # Symbols:
# CHECK-NEXT: # Address Size File Name
@@ -48,6 +52,7 @@
# CHECK-DAG: 0x[[#%X,HIITSME]] 0x0000000F [ 3] literal string: Hello, it's me
# CHECK-DAG: 0x[[#%X,HIITSME + 0xf]] 0x0000000E [ 3] literal string: Hello world!\n
# CHECK-DAG: 0x[[#%X,NUMBER]] 0x00000001 [ 1] _number
+# CHECK-DAG: 0x[[#%X,UNWIND]] 0x0000103C [ 0] compact unwind info
# MAPFILE: "name":"Total Write map file"
@@ -89,7 +94,10 @@ __ZTIN3foo3bar4MethE:
.globl _main, _bar
_main:
+.cfi_startproc
+.cfi_def_cfa_offset 16
ret
+.cfi_endproc
_bar:
nop
More information about the llvm-commits
mailing list