[libcxx-commits] [PATCH] D86805: [lld-macho] create __TEXT, __unwind_info from __LD, __compact_unwind

Jez Ng via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 8 17:15:06 PDT 2020


int3 added inline comments.


================
Comment at: lld/MachO/UnwindInfo.cpp:90-92
+        if (targetIsec->getVA() == 0) {
+          error(Twine("__compact_unwind relocation is unresolved against " +
+                      targetIsec->segname + "," + targetIsec->name));
----------------
Is this check really necessary? What kind of errors are we defending against? I would rather we not loop over the relocations unless necessary (for performance)


================
Comment at: lld/MachO/UnwindInfo.cpp:95-96
+      } else {
+        error(Twine("__compact_unwind relocation is not section based: " +
+                    targetIsec->segname + "," + targetIsec->name));
+      }
----------------
CU relocations can be section-based. Just checked a simple program:

```
~/tmp: llvm-readobj --relocations --expand-relocs bar.o

File: bar.o
Format: Mach-O 64-bit x86-64
Arch: x86_64
AddressSize: 64bit
Relocations [
  Section __compact_unwind {
    Relocation {
      Offset: 0x0
      PCRel: 0
      Length: 3
      Type: X86_64_RELOC_UNSIGNED (0)
      Section: __text (1)
    }
  }
]
~/tmp: cat bar.cpp
int foo() {
  return 123;
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86805/new/

https://reviews.llvm.org/D86805



More information about the libcxx-commits mailing list