mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 11:02:04 +08:00
[BOLT] Don't choke on nobits symbols (#136384)
This commit is contained in:
@@ -1055,10 +1055,11 @@ void RewriteInstance::discoverFileObjects() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Section->isText()) {
|
||||
if (!Section->isText() || Section->isVirtual()) {
|
||||
assert(SymbolType != SymbolRef::ST_Function &&
|
||||
"unexpected function inside non-code section");
|
||||
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: rejecting as symbol is not in code\n");
|
||||
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: rejecting as symbol is not in code or "
|
||||
"is in nobits section\n");
|
||||
registerName(SymbolSize);
|
||||
continue;
|
||||
}
|
||||
|
||||
24
bolt/test/X86/nobits-symbol.s
Normal file
24
bolt/test/X86/nobits-symbol.s
Normal file
@@ -0,0 +1,24 @@
|
||||
## Check that llvm-bolt doesn't choke on symbols defined in nobits sections.
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
|
||||
# RUN: %clang %cflags %t.o -o %t.exe
|
||||
# RUN: llvm-bolt %t.exe -o %t
|
||||
#
|
||||
|
||||
.type symbol_in_nobits,@object
|
||||
.section .my.nobits.section,"awx",@nobits
|
||||
.globl symbol_in_nobits
|
||||
.p2align 4, 0x0
|
||||
symbol_in_nobits:
|
||||
.zero 0x100000
|
||||
.size symbol_in_nobits, 0x100000
|
||||
|
||||
.text
|
||||
.globl main
|
||||
.type main, %function
|
||||
main:
|
||||
.cfi_startproc
|
||||
.LBB06:
|
||||
retq
|
||||
.cfi_endproc
|
||||
.size main, .-main
|
||||
Reference in New Issue
Block a user