[llvm-objcopy][MachO] Fix MachO::relocation_info use after 386f1c114d5.
Use shift/mask operations to access r_symbolnum rather than relying on
MachO::relocation_info. This should fix the big-endian bot failures that were
caused by 386f1c114d5.
diff --git a/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp b/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
index 29525c6..a08d54d 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
@@ -240,11 +240,9 @@
Sec->Content.size());
for (size_t Index = 0; Index < Sec->Relocations.size(); ++Index) {
auto RelocInfo = Sec->Relocations[Index];
- if (!RelocInfo.Scattered) {
- auto *Info =
- reinterpret_cast<MachO::relocation_info *>(&RelocInfo.Info);
- Info->r_symbolnum = RelocInfo.Symbol->Index;
- }
+ if (!RelocInfo.Scattered)
+ RelocInfo.setPlainRelocationSymbolNum(RelocInfo.Symbol->Index,
+ O.isLittleEndian());
if (IsLittleEndian != sys::IsLittleEndianHost)
MachO::swapStruct(