Implement command-line options to rename output sections & segments.
Details
- Reviewers
int3 - Group Reviewers
Restricted Project - Commits
- rG6f9dd843db40: [lld-macho] Implement options -rename_section -rename_segment
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
110 ms | x64 windows > Clang.CodeGenCXX::attr-retain.cpp |
Event Timeline
lld/MachO/InputFiles.cpp | ||
---|---|---|
109 | FYI: This turned-up in my option-parsing test: when I omitted a sub-arg, then it swallowed -o, leaving /dev/null without a prefix, so it was interpreted as an input filename. Since its size was zero, ASAN caught the attempted read of the non-existent header. |
lld/MachO/Config.h | ||
---|---|---|
29–30 | try to avoid std::map in general (as per the LLVM programmer's manual). In this case we could use a DenseMap of NamePair and a DenseMap of CachedHashStringRef respectively | |
87–94 | Config should be just a plain bag of values. I think this can be a standalone function in Writer.cpp | |
lld/MachO/Driver.cpp | ||
822 | ||
lld/MachO/InputFiles.cpp | ||
109 | Ah, nice catch. This should probably be in a separate diff with its own test. Also, I think we should make it an error if the file is shorter than sizeof(hdr->magic)... one issue though is that we currently use readFile to read non-binary files like the symbol order file, but I think we can just create a separate function for that |
lld/MachO/Config.h | ||
---|---|---|
29–30 | Why CachedHashStringRef ? Is that supposed to give us some code sharing, at the expense of clarity? |
lld/MachO/Config.h | ||
---|---|---|
29–30 | It saves on recomputation of the hash. Not that it matters here since this map shouldn't part of a hot loop, but I just use it everywhere we need a map of string keys, so I don't have to think about whether performance is important in a particular case. There's also StringMap, but that allocates and owns its own strings, which for LLD isn't really optimal since our strings are mostly interned / not deallocated till the end of the process. | |
lld/test/MachO/rename.s | ||
34 |
- amend according to review feedback
- migrate some changes to lld/test/MachO/rename.s from a successor diff that really belong here
Looks like this breaks tests on windows: http://45.33.8.238/win/34054/step_10.txt
Please take a look, and revert for now if it takes a while to fix.
try to avoid std::map in general (as per the LLVM programmer's manual). In this case we could use a DenseMap of NamePair and a DenseMap of CachedHashStringRef respectively