labath added a comment. In D72751#1847617 <https://reviews.llvm.org/D72751#1847617>, @clayborg wrote:
> Yes the current approach allows anyone to load any section at any address. On > Darwin systems, the DYLD shared cache will move __TEXT, __DATA, and other > sections around such that all __TEXT sections from all shared libraries in > the shared cache are all in the one contiguous range. The slide is different > for each section, so we have some nice flexibility with being able to set the > section load address individually. They will even invert the memory order > sometimes where in the file we have __TEXT followed by __DATA, but in the > shared cache __DATA appears at a lower address than __TEXT. Sorry about the off-topic, but I found this bit very interesting. Greg, how does this work with code referencing the variables in the data section (e.g. `static int x; int *f() { return &x; }`). This code on elf, even when linked in fully position-independent mode will not contain any relocations because it is assumed that the dynamic loader will not change the relative layout of code and data (and so the code can use pc-relative addressing). This obviously does not work if data can be moved around independently. Does that mean that darwin will include some additional relocations which need to be resolved at load time? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72751/new/ https://reviews.llvm.org/D72751 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits