So far we've only supported symbol relocations.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lld/MachO/InputFiles.cpp | ||
---|---|---|
157 | Error messages are usually not capitalized. It'd be nice to have a test for zero r_symbolnum |
lld/test/MachO/relocations.s | ||
---|---|---|
45 | You can also use the same string but place the both labels at the same place. Up to you. |
lld/MachO/InputFiles.cpp | ||
---|---|---|
157 | Do you mean test as in unit test or an if-check? I don't think we can generate a zero r_symbolnum when for a non-extern relocation. I can check for it here though |
lld/MachO/InputFiles.cpp | ||
---|---|---|
156 | Should add more details to the error message, e.g. the object file being processed and details about the relocation. | |
lld/MachO/InputSection.cpp | ||
52 | Perhaps "the relocated target section", to make it completely clear which section is being referred to? | |
54 | r.offset is relative to the start of the input section containing the relocation. Doesn't this need to be adjusted for the address of that input section as well? As in: addend -= isec->header->addr - (header->addr + r.offset + 4); I was gonna comment that the + 4 seems specific to x86-64; on ARM64, for example, the PC refers to the current instruction and not the next one. However, I actually can't get LLVM to produce a non-extern relocation for ARM64. ld64 does handle non-extern ARM64_RELOC_UNSIGNED relocations, but for anything I feed to LLVM, it converts local symbols to linker-local symbols and just uses an extern relocation. The other thing I noticed looking at ld64 is that we aren't using or validating the length field of the relocation anywhere, which is potentially problematic. | |
lld/test/MachO/relocations.s | ||
48 | How come the comment in the next test about needing to create a new section to force a section relocation doesn't apply? Is the cstring section a special case? (Wouldn't surprise me since IIRC the linker atomizes the cstring section automatically based on zero termination instead of atomizing based on symbols.) |
lld/MachO/InputFiles.cpp | ||
---|---|---|
156 | hm, I think this is a really unlikely (and therefore fatal) error for sane inputs, but okay... I do agree that error() messages should give useful hints to the user though | |
lld/MachO/InputSection.cpp | ||
54 | Oops, I guess I hadn't realized this since the relocations have all been in the __text section... Re ARM, I guess we'll eventually have something similar to the getDylibSymbolVA above. I'll add a TODO comment. And yeah, I need to figure out the significance of the length field. | |
lld/test/MachO/relocations.s | ||
48 | oh, good observation... yeah, it seems like __cstring is special. I tried renaming it to __not_cstring while keeping .asciz values and this turned into a symbol relocation |
address comments
lld/MachO/InputSection.cpp | ||
---|---|---|
52 | good point. I think I'll just say "target section", once it's an offset it's irrelevant whether the section has been relocated |
Should add more details to the error message, e.g. the object file being processed and details about the relocation.