MachOObjectfile.cpp wrong values in getDyldChainedFixupTargets() for DYLD_CHAINED_IMPORT_ADDEND64
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Object/MachOObjectFile.cpp#L5290-L5293
The wrong offsets are used for NameOffset and WeakImport. The struct is defined properly here https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/MachO.h#L1150-L1172 but when trying to populate the struct, the wrong values are used.
Should be
```
LibOrdinal = getEncodedOrdinal(RawValue[0] & 0xFFFF);
WeakImport = (RawValue[0] >> 16) & 1;
Reserved = RawValue[0] >> 17;
NameOffset = RawValue[0] >> 32;
Addend = RawValue[1];```
Contributor guide
Research direction
Start in llvm/lib/Object/MachOObjectFile.cpp at getDyldChainedFixupTargets(), around lines 5290–5293, and compare the field extraction with the struct definition in llvm/include/llvm/BinaryFormat/MachO.h. Verify that the affected DYLD_CHAINED_IMPORT_ADDEND64 values use the offsets and bit ranges listed in the issue, then validate the Mach-O parsing behavior with the relevant project checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100