Details
- Reviewers
jhenderson alexander-shaposhnikov jakehehrlich rupprecht rnk - Commits
- rG12b6b802080e: Reapply: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
rG1bf1964a151a: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
rL351931: Reapply: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
rL351801: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
Diff Detail
Event Timeline
test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test | ||
---|---|---|
4–5 | I know it's not strictly necessary, but it would be nice if comments like this had some sort of leading character, e.g. '#' to make them stand out better. | |
24 | Just to confirm, this new section is supposed to have a virtual address, i.e. it is loaded at runtime? | |
tools/llvm-objcopy/COFF/COFFObjcopy.cpp | ||
38 | Are sections required to be in address order? | |
52 | Rather than modifying in place via a reference, I think it would be better if this returned the section data. | |
54 | This is probably an instance of too much auto. | |
170 | I just want to confirm that GNU objcopy doesn't add a gnu debug link section if it is not PE? | |
tools/llvm-objcopy/COFF/Object.h | ||
46 | I'd probably rename this to ModifiedContents or similar. It isn't clear to me what "Local" means in this context. |
tools/llvm-objcopy/COFF/Object.h | ||
---|---|---|
46 | Either works for me. |
test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test | ||
---|---|---|
4–5 | Ok, will add. (The same goes for a lot of the other tests I've added here as well.) | |
24 | This is at least how GNU objcopy does it. It's not loaded at runtime (it's got the IMAGE_SCN_MEM_DISCARDABLE flag set which means not loaded), but despite this all sections get a virtual address allocated. IIRC windows is pretty picky with this - all sections need to be consecutive without holes, even the ones that aren't loaded. | |
tools/llvm-objcopy/COFF/COFFObjcopy.cpp | ||
38 | I believe so, yes: https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#section-table-section-headers
| |
52 | Sure | |
54 | Ok, will write out the types. (The ELF dir uses auto similarly though.) | |
170 | GNU objcopy doesn't make a difference, so I'll remove that condition. |
tools/llvm-objcopy/COFF/COFFObjcopy.cpp | ||
---|---|---|
54 | I know, and I've disagreed with it there in some places too! | |
57 | This one CAN be auto, because its type is clear from the type of LinkTargetOrErr. | |
tools/llvm-objcopy/COFF/Object.h | ||
46 | Thinking about this a bit more, I wonder if it would be a good idea for there to be a getContents function that decides which to fetch. This feels like a potential risk point for bugs, if people try to get Contents when it is owned by OrigContents. You'd want to make them both private as a result, and therefore add some setters too. |
tools/llvm-objcopy/COFF/Object.h | ||
---|---|---|
46 | Right, that makes the code much clearer. |
llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp | ||
---|---|---|
292–293 ↗ | (On Diff #182877) | I didn't spot this earlier, but why are you padding assuming it is x86? |
llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp | ||
---|---|---|
292–293 ↗ | (On Diff #182877) | Yeah, ideally we'd use a different padding pattern for other arches. So far, LLD/COFF always uses this padding pattern regardless of architecture (while LLD/ELF uses arch specific paddings), and I'm matching that behaviour for now here. I'd like to bring it up for discussion in LLD first, and once some other paddings are settled on there, I'd implement the same over here. |
I know it's not strictly necessary, but it would be nice if comments like this had some sort of leading character, e.g. '#' to make them stand out better.