diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -698,8 +698,6 @@ sym.n_desc & REFERENCED_DYNAMICALLY, sym.n_desc & N_NO_DEAD_STRIP, isWeakDefCanBeHidden); } - assert(!isWeakDefCanBeHidden && - "weak_def_can_be_hidden on already-hidden symbol?"); bool includeInSymtab = !isPrivateLabel(name) && !isEhFrameSection(isec); return make( name, isec->getFile(), isec, value, size, sym.n_desc & N_WEAK_DEF, diff --git a/lld/test/MachO/weak-def-can-be-hidden.s b/lld/test/MachO/weak-def-can-be-hidden.s --- a/lld/test/MachO/weak-def-can-be-hidden.s +++ b/lld/test/MachO/weak-def-can-be-hidden.s @@ -116,6 +116,10 @@ _foo: retq +# An alias is the only way to set .weak_def_can_be_hidden on an already-hidden symbol. +# Veryify that LLD can handle these double-hidden symbols gracefully. +.set l_foo, _foo + #--- weak-foo-pe.s .private_extern _foo .globl _foo