Issue 233880
Summary ld64.lld silently mis-links programs with fixups beyond page UINT16_MAX
Labels lld:MachO
Assignees
Reporter nico
    ```
% cat lld-macho-bigdata/bigc.c
struct S {
  void *p;
  char pad[1 << 30];
 int (*q)(void);
};
static int done(void) { return 42; }
struct S s = {&s, {0}, done};
int main(void) { return s.q(); }
```

```
% bin/clang lld-macho-bigdata/bigc.c -isysroot $(xcrun -show-sdk-path) -fuse-ld=lld 
% ./a.out
zsh: segmentation fault  ./a.out
```

Passing ` -Wl,-no_fixup_chains` makes it pass.

Interestingly, Xcode's ld behaves the same way.

We ran into this in practice (crbug.com/574507659), would probably be nice to emit a diag advertising to use `-no_fixup_chains` in this case.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to