IRGen: handle ASAN better with importing on ELF

ELF's lack of linker directives is worked around by a custom section
(`.swift1_autolink_entries`).  This is metadata that is not intended to
be emitted into the linked binary.  A previous change introduced the use
of a module (global) assembly gadget to discard the section.  However,
this interacts poorly with ASAN which would instrument the section,
resulting in a strong reference.  This reference would persist to a
discarded symbol.  lld would object to this.  Blacklist the symbol to
ensure that ASAN + autolinking can co-exist.
This commit is contained in:
Saleem Abdulrasool
2020-01-09 21:48:25 -08:00
parent 90d94c8b0d
commit 837e331f16
2 changed files with 12 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
#include "llvm/Support/MD5.h"
#include "ConformanceDescription.h"
#include "GenDecl.h"
#include "GenEnum.h"
#include "GenIntegerLiteral.h"
#include "GenType.h"
@@ -1190,6 +1191,7 @@ void IRGenModule::emitAutolinkInfo() {
var->setSection(".swift1_autolink_entries");
var->setAlignment(getPointerAlignment().getValue());
disableAddressSanitizer(*this, var);
addUsedGlobal(var);
}