[lld-macho] Remove partially supported 32-bit ARM arch

We never really supported 32-bit ARM arch entirely, and partial support was added for
very specific features. Regardless, it fails to even link the most basic applications that at
this point, it might be better to move this arch as unsupported. Given that Apple will be
moving towards arm64 long term, I don't see any reason for anyone to invest time in
supporting this either, and for those who still need it should use apple's ld64 linker.

Fixes #62691

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D150544
This commit is contained in:
Vincent Lee
2023-05-15 02:00:29 -07:00
parent ac73c48e09
commit ed59b8a11c
16 changed files with 40 additions and 377 deletions

View File

@@ -655,6 +655,8 @@ static macho::Symbol *createDefined(const NList &sym, StringRef name,
bool isWeakDefCanBeHidden =
(sym.n_desc & (N_WEAK_DEF | N_WEAK_REF)) == (N_WEAK_DEF | N_WEAK_REF);
assert(!(sym.n_desc & N_ARM_THUMB_DEF) && "ARM32 arch is not supported");
if (sym.n_type & N_EXT) {
// -load_hidden makes us treat global symbols as linkage unit scoped.
// Duplicates are reported but the symbol does not go in the export trie.
@@ -697,16 +699,14 @@ static macho::Symbol *createDefined(const NList &sym, StringRef name,
isPrivateExtern = true;
return symtab->addDefined(
name, isec->getFile(), isec, value, size, sym.n_desc & N_WEAK_DEF,
isPrivateExtern, sym.n_desc & N_ARM_THUMB_DEF,
sym.n_desc & REFERENCED_DYNAMICALLY, sym.n_desc & N_NO_DEAD_STRIP,
isWeakDefCanBeHidden);
isPrivateExtern, sym.n_desc & REFERENCED_DYNAMICALLY,
sym.n_desc & N_NO_DEAD_STRIP, isWeakDefCanBeHidden);
}
bool includeInSymtab = !isPrivateLabel(name) && !isEhFrameSection(isec);
return make<Defined>(
name, isec->getFile(), isec, value, size, sym.n_desc & N_WEAK_DEF,
/*isExternal=*/false, /*isPrivateExtern=*/false, includeInSymtab,
sym.n_desc & N_ARM_THUMB_DEF, sym.n_desc & REFERENCED_DYNAMICALLY,
sym.n_desc & N_NO_DEAD_STRIP);
sym.n_desc & REFERENCED_DYNAMICALLY, sym.n_desc & N_NO_DEAD_STRIP);
}
// Absolute symbols are defined symbols that do not have an associated
@@ -714,18 +714,20 @@ static macho::Symbol *createDefined(const NList &sym, StringRef name,
template <class NList>
static macho::Symbol *createAbsolute(const NList &sym, InputFile *file,
StringRef name, bool forceHidden) {
assert(!(sym.n_desc & N_ARM_THUMB_DEF) && "ARM32 arch is not supported");
if (sym.n_type & N_EXT) {
bool isPrivateExtern = sym.n_type & N_PEXT || forceHidden;
return symtab->addDefined(
name, file, nullptr, sym.n_value, /*size=*/0,
/*isWeakDef=*/false, isPrivateExtern, sym.n_desc & N_ARM_THUMB_DEF,
/*isReferencedDynamically=*/false, sym.n_desc & N_NO_DEAD_STRIP,
/*isWeakDefCanBeHidden=*/false);
return symtab->addDefined(name, file, nullptr, sym.n_value, /*size=*/0,
/*isWeakDef=*/false, isPrivateExtern,
/*isReferencedDynamically=*/false,
sym.n_desc & N_NO_DEAD_STRIP,
/*isWeakDefCanBeHidden=*/false);
}
return make<Defined>(name, file, nullptr, sym.n_value, /*size=*/0,
/*isWeakDef=*/false,
/*isExternal=*/false, /*isPrivateExtern=*/false,
/*includeInSymtab=*/true, sym.n_desc & N_ARM_THUMB_DEF,
/*includeInSymtab=*/true,
/*isReferencedDynamically=*/false,
sym.n_desc & N_NO_DEAD_STRIP);
}
@@ -1366,7 +1368,7 @@ void ObjFile::registerEhFrames(Section &ehFrameSection) {
make<Defined>("EH_Frame", isec->getFile(), isec, /*value=*/0,
isec->getSize(), /*isWeakDef=*/false, /*isExternal=*/false,
/*isPrivateExtern=*/false, /*includeInSymtab=*/false,
/*isThumb=*/false, /*isReferencedDynamically=*/false,
/*isReferencedDynamically=*/false,
/*noDeadStrip=*/false);
else if (isec->symbols[0]->value != 0)
fatal("found symbol at unexpected offset in __eh_frame");
@@ -2184,7 +2186,6 @@ static macho::Symbol *createBitcodeSymbol(const lto::InputFile::Symbol &objSym,
return symtab->addDefined(name, &file, /*isec=*/nullptr, /*value=*/0,
/*size=*/0, objSym.isWeak(), isPrivateExtern,
/*isThumb=*/false,
/*isReferencedDynamically=*/false,
/*noDeadStrip=*/false,
/*isWeakDefCanBeHidden=*/false);