lhames wrote:

> In clang-repl, R_*_32 relocations are emitted as direct 32-bit PC-relative 
> references. A normal static linker can resolve references to distinct symbol 
> through the GOT or Copy relocation, but clang-repl directly mmaps shared 
> objects into memory and bypasses the static linker.

Can you be more specific about the relocations that you're seeing?

CodeGen usually requests a GOT entry (by selecting one of the GOT relocations 
and producing the necessary instruction sequence), and the linker just builds 
the requested GOT entry.

The usual caveat is hidden symbols:
```c
extern int __attribute__((visibility("hidden"))) X;
int getX() { return X; } // <- will typically emit 32-bit PC-relative reference
```

The problem in this case is that ClangRepl probably isn't doing slab allocation 
by default, in which case switching to a slab-based allocator is the best 
answer.

https://github.com/llvm/llvm-project/pull/201286
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to