diff options
author | Nick Kledzik <kledzik@apple.com> | 2014-11-12 22:21:56 +0000 |
---|---|---|
committer | Nick Kledzik <kledzik@apple.com> | 2014-11-12 22:21:56 +0000 |
commit | 16cfa60cbd8c792228fc9d112c5bcc1b7eb55743 (patch) | |
tree | 5424bf9cf159e408381f570d0aa5634be8391cf7 /lld/lib/Core/DefinedAtom.cpp | |
parent | 0140aa8756d5a8fa58a0a02b306aa685d22caa42 (diff) | |
download | bcm5719-llvm-16cfa60cbd8c792228fc9d112c5bcc1b7eb55743.tar.gz bcm5719-llvm-16cfa60cbd8c792228fc9d112c5bcc1b7eb55743.zip |
[mach-o] Support linker synthesized mach_header symbols.
On darwin in final linked images, the __TEXT segment covers that start of the
file. That means in memory a process can see the mach_header (and load commands)
for every loaded image in a process. There are APIs that take and return the
mach_header addresses as a way to specify a particular loaded image.
For completeness, any code can get the address of the mach_header of the image
it is in by using &__dso_handle. In addition there are mach-o type specific
symbols like __mh_execute_header.
The linker needs to supply a definition for any of these symbols if used. But
the address the symbol it resolves to is not in any section. Instead it is the
address of the start of the __TEXT segment.
I needed to make a small change to SimpleFileNode to not override
resetNextIndex() because the Driver creates a SimpleFileNode to hold the
internal/implicit files that the context/writer can create. For some reason
SimpleFileNode overrode resetNextIndex() to do nothing instead of reseting
the index (which mach-o needs if the internal file is an archive).
llvm-svn: 221822
Diffstat (limited to 'lld/lib/Core/DefinedAtom.cpp')
-rw-r--r-- | lld/lib/Core/DefinedAtom.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lld/lib/Core/DefinedAtom.cpp b/lld/lib/Core/DefinedAtom.cpp index fa2fa45f695..298a768b111 100644 --- a/lld/lib/Core/DefinedAtom.cpp +++ b/lld/lib/Core/DefinedAtom.cpp @@ -28,6 +28,7 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) { case typeBranchShim: case typeStub: case typeStubHelper: + case typeMachHeader: return permR_X; case typeConstant: |