SixWeining added a comment.
In D145550#4177291 <https://reviews.llvm.org/D145550#4177291>, @DavidSpickett
wrote:
> Seems to me that member functions of `ELFRelocation` should use the typedefs
> from `lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h` where there is one.
> `elf_sxword` for example.
>
> If you want to do that in another patch, that's fine. Just in case some test
> case is relying on the uin64_t -> unsigned down cast unintentionally.
Yes, I agree. Let me do that in another patch. Thanks.
================
Comment at: lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml:37
Type: R_LARCH_64
- Addend: 0x5678
+ Addend: 0x1122334455667788
Symbols:
----------------
DavidSpickett wrote:
> I'm not familiar with how these relocation are processed, would it be better
> to use something with the sign bit set here? Or does it not matter, the value
> is just copied into .debug_info verbatim anyway.
For this case, it is processed by below code:
```
2596 static void ApplyELF64ABS64Relocation(Symtab *symtab, ELFRelocation &rel,
2597 DataExtractor &debug_data,
2598 Section *rel_section) {
2599 Symbol *symbol =
symtab->FindSymbolByID(ELFRelocation::RelocSymbol64(rel));
2600 if (symbol) {
2601 addr_t value = symbol->GetAddressRef().GetFileAddress();
2602 DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
2603 // ObjectFileELF creates a WritableDataBuffer in CreateInstance.
2604 WritableDataBuffer *data_buffer =
2605 llvm::cast<WritableDataBuffer>(data_buffer_sp.get());
2606 uint64_t *dst = reinterpret_cast<uint64_t *>(
2607 data_buffer->GetBytes() + rel_section->GetFileOffset() +
2608 ELFRelocation::RelocOffset64(rel));
2609 uint64_t val_offset = value + ELFRelocation::RelocAddend64(rel);
2610 memcpy(dst, &val_offset, sizeof(uint64_t));
2611 }
2612 }
```
Memcpy `S + A` to .debug_info.
I can add another relocation entry with the sign bit set.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145550/new/
https://reviews.llvm.org/D145550
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits