File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -1055,10 +1055,11 @@ void RewriteInstance::discoverFileObjects() {
1055
1055
continue ;
1056
1056
}
1057
1057
1058
- if (!Section->isText ()) {
1058
+ if (!Section->isText () || Section-> isVirtual () ) {
1059
1059
assert (SymbolType != SymbolRef::ST_Function &&
1060
1060
" unexpected function inside non-code section" );
1061
- LLVM_DEBUG (dbgs () << " BOLT-DEBUG: rejecting as symbol is not in code\n " );
1061
+ LLVM_DEBUG (dbgs () << " BOLT-DEBUG: rejecting as symbol is not in code or "
1062
+ " is in nobits section\n " );
1062
1063
registerName (SymbolSize);
1063
1064
continue ;
1064
1065
}
Original file line number Diff line number Diff line change
1
+ ## Check that llvm-bolt doesn't choke on symbols defined in nobits sections.
2
+
3
+ # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
4
+ # RUN: %clang %cflags %t.o -o %t.exe
5
+ # RUN: llvm-bolt %t.exe -o %t
6
+ #
7
+
8
+ .type symbol_in_nobits,@object
9
+ .section .my.nobits.section,"awx" ,@nobits
10
+ .globl symbol_in_nobits
11
+ .p2align 4 , 0x0
12
+ symbol_in_nobits:
13
+ .zero 0x100000
14
+ .size symbol_in_nobits, 0x100000
15
+
16
+ .text
17
+ .globl main
18
+ .type main, %function
19
+ main:
20
+ .cfi_startproc
21
+ .LBB06:
22
+ retq
23
+ .cfi_endproc
24
+ .size main, .-main
You can’t perform that action at this time.
0 commit comments