Skip to content

Commit bbcff82

Browse files
authored
Merge pull request swiftlang#29112 from compnerd/elf-autolink-sanitization
IRGen: handle ASAN better with importing on ELF
2 parents e7a4e59 + 837e331 commit bbcff82

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include "llvm/Support/MD5.h"
5151

5252
#include "ConformanceDescription.h"
53+
#include "GenDecl.h"
5354
#include "GenEnum.h"
5455
#include "GenIntegerLiteral.h"
5556
#include "GenType.h"
@@ -1190,6 +1191,7 @@ void IRGenModule::emitAutolinkInfo() {
11901191
var->setSection(".swift1_autolink_entries");
11911192
var->setAlignment(getPointerAlignment().getValue());
11921193

1194+
disableAddressSanitizer(*this, var);
11931195
addUsedGlobal(var);
11941196
}
11951197

test/IRGen/ELF-remove-autolink-section.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,15 @@
1313
print("Hi from Swift!")
1414

1515
// ELF: module asm ".section .swift1_autolink_entries,\220x80000000\22"
16+
17+
// Find the metadata entry for the blacklisting of the metadata symbol
18+
// Ensure that it is in the ASAN metadata
19+
20+
// ELF-DAG: !llvm.asan.globals = !{
21+
// ELF-SAME: [[MD:![0-9]+]]
22+
// ELF-SAME: }
23+
24+
// ELF-DAG: [[MD]] = !{[37 x i8]* @_swift1_autolink_entries, null, null, i1 false, i1 true}
25+
1626
// SECTION: .swift1_autolink_entries
1727
// NOSECTION-NOT: .swift1_autolink_entries

0 commit comments

Comments
 (0)