llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.44k stars 11.76k forks source link

[mach-o] Symbol offset not relevant in out-of-order nlists #22029

Closed llvmbot closed 3 years ago

llvmbot commented 9 years ago
Bugzilla Link 21655
Resolution WONTFIX
Resolved on Feb 19, 2021 16:00
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @int3

Extended Description

In MachONormalizedFileBinaryReader.cpp at around ln432, the symtab nlists are incorrectly assumed to be in-order from local to global to undefined. As a result, relocations in MachONormalizedFileToAtoms.cpp at ln538 are improperly assigned. The symbol index corresponds to whatever order the nlist is in, thus all symbols should be parsed to the same array, rather than three disparate ones.

Symptoms shown are cstrings and other data relocations appear to work if viewed in a Mach-o reader, they will just point to the wrong entry in that nlist. Keep in mind for repro that it's entirely possible the nlist is in the right order, given a small symtab.

int3 commented 3 years ago

Closing this as it applies to the old iteration of LLD-MachO which is not being developed. (The new one is named ld64.lld.darwinnew, and will be receiving active feature development and bug fixes.)

silvasean commented 8 years ago

Moving to more specific "MachO" LLD component (instead of generic "All Bugs").