That's what ld64 uses for 64-bit targets. I figured it's best
to make this change sooner rather than later since a bunch of our tests
are relying on hardcoded addresses that depend on this value.
Depends on D80169.
Paths
| Differential D80177
[lld-macho] Set __PAGEZERO size to 4GB ClosedPublic Authored by int3 on May 18 2020, 9:09 PM.
Details Summary That's what ld64 uses for 64-bit targets. I figured it's best Depends on D80169.
Diff Detail
Event TimelineComment Actions Thanks for fixing this! It'll make it way easier to compare results with ld64. Requesting changes cos I think we're gonna mess up entryoff as this stands, and we definitely need to add test coverage for that.
This revision now requires changes to proceed.May 19 2020, 1:43 PM Comment Actions Looks great, thanks!
This revision is now accepted and ready to land.May 19 2020, 3:34 PM
Closed by commit rGa04c133564e6: [lld-macho] Set __PAGEZERO size to 4GB (authored by int3). · Explain WhyJun 2 2020, 1:44 PM This revision was automatically updated to reflect the committed changes. Comment Actions Thanks for the heads up, just pushed a likely fix and will monitor http://lab.llvm.org:8011/builders/lld-x86_64-win. I'll set up a local Windows VM to catch future such issues earlier... Comment Actions
@int3, can you please point out the fix you pushed? The tests are failing downstream, and I am looking for the commit that fixes it. Moreover, in the head llvm-project there are still issues for 32-bit host builds: enum : uint64_t { ... PageZeroSize = 1ull << 32, // XXX should be 4096 for 32-bit targets ... }; PageZeroSize is a 64-bit constant, but it is being returned as size_t, which is 4 bytes for 32-bit hosts: class PageZeroSection : public SyntheticSection { ... size_t getSize() const override { return PageZeroSize; } ... Could you please fix this? Comment Actions rGd767de44bf9527cb5058f5fe16aac2f23c21977c was the referenced fix. Good point about size_t, I'll change that Comment Actions
Thanks. The enum change does not fix the fails on my side. I guess it has to be the size_t issue.
Revision Contents
Diff 267981 lld/MachO/Symbols.h
lld/MachO/Symbols.cpp
lld/MachO/SyntheticSections.h
lld/MachO/Target.h
lld/MachO/Writer.cpp
lld/test/MachO/entry-symbol.s
lld/test/MachO/segments.s
lld/test/MachO/x86-64-reloc-signed.s
lld/test/MachO/x86-64-reloc-unsigned.s
|
This is *definitely* follow-up territory, but we should figure out if it ever makes sense for getFileOffset to be called on a non-defined symbol, and if not, just fail loudly in that case instead of silently returning 0.