[llvm] [Object][GOFF] Support RLD records (PR #216780)
Sean Fertile via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 10:14:38 PDT 2026
================
@@ -759,3 +765,118 @@ basic_symbol_iterator GOFFObjectFile::symbol_end() const {
DataRefImpl Symb;
return basic_symbol_iterator(SymbolRef(Symb, this));
}
+
+// Populate the relocation entries.
+void GOFFObjectFile::setRelocationData(const uint8_t *RldRecord) {
+ SmallVector<uint8_t, 8> RelocationData;
+ int DataIndex = 6;
+ uint16_t DataLength;
+ RLDRecord::getDataLength(RldRecord, DataLength);
+ Expected<unsigned> BlocksConsumed =
+ getContinuousData(RelocationData, DataIndex, DataLength, RldRecord);
+ if (!BlocksConsumed)
+ llvm::handleAllErrors(BlocksConsumed.takeError(),
+ [](const llvm::ErrorInfoBase &EIB) {
+ llvm::errs() << "ERROR: " << EIB.message() << "\n";
+ });
+ assert(static_cast<size_t>(DataLength + DataIndex) == RelocationData.size() &&
+ "Inconsistent rld size");
+
+ uint8_t *RldI = reinterpret_cast<uint8_t *>(RelocationData.data());
+ uint8_t *RldE = RldI + RelocationData.size();
+ for (uint8_t *Rld = RldI + DataIndex; Rld < RldE;) {
+ GOFFRelEntry RelEntry;
+ uint8_t Flags = Rld[0];
+
+#define SAME_R_ID 0x80
----------------
mandlebug wrote:
```suggestion
inline constexpr uint8_t SAME_R_ID = 0x80
```
At the top of the file instead
https://github.com/llvm/llvm-project/pull/216780
More information about the llvm-commits
mailing list