Class DylibStubContentsScrubber
- java.lang.Object
-
- com.facebook.buck.cxx.toolchain.objectfile.DylibStubContentsScrubber
-
- All Implemented Interfaces:
FileContentsScrubber
,FileScrubber
public class DylibStubContentsScrubber extends Object implements FileContentsScrubber
Scrubs the contents of dylib stubs, so that they're independent of the contents of the source dylib. That means that if the source dylib's ABI does not change, it will produce the exact same dylib stub.The linker itself does not actually care about the symbol addresses, it just wants to ensure any referenced symbols exist. That means we can reset the addresses to any value we would like. Note that the symbol addresses themselves are already invalid in the dylib stub, as the contents (i.e., binary instructions) have been stripped by "strip".
Dylib stubs produced by "strip" are still dependent on symbol addresses and the UUID. To make them independent, we do the following:
- Set the UUID to the same value each time
- Update the _LINKEDIT segment and remove any addresses for symbols
- Update the exports info
- Update the symbol table
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.facebook.buck.io.file.FileScrubber
FileScrubber.ScrubException
-
-
Constructor Summary
Constructors Constructor Description DylibStubContentsScrubber()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
scrubFile(FileChannel file)
Override this method to perform the content modification.
-
-
-
Method Detail
-
scrubFile
public void scrubFile(FileChannel file) throws IOException, FileScrubber.ScrubException
Description copied from interface:FileContentsScrubber
Override this method to perform the content modification.- Specified by:
scrubFile
in interfaceFileContentsScrubber
- Throws:
IOException
FileScrubber.ScrubException
-
-