File tree Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -778,13 +778,17 @@ void BinaryContext::populateJumpTables() {
778778 }
779779
780780 if (opts::StrictMode && DataPCRelocations.size ()) {
781- LLVM_DEBUG ({
782- dbgs () << DataPCRelocations.size ()
783- << " unclaimed PC-relative relocations left in data:\n " ;
784- for (uint64_t Reloc : DataPCRelocations)
785- dbgs () << Twine::utohexstr (Reloc) << ' \n ' ;
786- });
787- assert (0 && " unclaimed PC-relative relocations left in data\n " );
781+ this ->errs () << " BOLT-ERROR: " << DataPCRelocations.size ()
782+ << " unclaimed PC-relative relocation(s) left in data" ;
783+ if (opts::Verbosity) {
784+ this ->errs () << " :\n " ;
785+ for (uint64_t RelocOffset : DataPCRelocations)
786+ this ->errs () << " @0x" << Twine::utohexstr (RelocOffset) << ' \n ' ;
787+ } else {
788+ this ->errs () << " . Re-run with -v=1 to see the list\n " ;
789+ }
790+ this ->errs () << " BOLT-ERROR: unable to proceed with --strict\n " ;
791+ exit (1 );
788792 }
789793 clearList (DataPCRelocations);
790794}
Original file line number Diff line number Diff line change 1+ ## Check that unclaimed PC-relative relocation from data to code is detected
2+ ## and reported to the user.
3+
4+ # REQUIRES: system-linux
5+
6+ # RUN: %clang %cflags -no-pie %s -o %t.exe -Wl,-q -nostartfiles
7+ # RUN: not llvm-bolt %t.exe -o %t.bolt --strict 2>&1 | FileCheck %s
8+
9+ # CHECK: BOLT-ERROR: 1 unclaimed PC-relative relocation(s) left in data
10+
11+ .text
12+ .globl _start
13+ .type _start, %function
14+ _start:
15+ movl $42 , %eax
16+ .L0:
17+ ret
18+ .size _start, .-_start
19+
20+ ## Force relocation mode.
21+ .reloc 0 , R_X86_64_NONE
22+
23+ .section .rodata
24+ .long .L0-.
You can’t perform that action at this time.
0 commit comments