File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -4129,8 +4129,14 @@ void BinaryFunction::updateOutputValues(const MCAsmLayout &Layout) {
4129
4129
(void )FragmentBaseAddress;
4130
4130
}
4131
4131
4132
- const uint64_t BBAddress =
4133
- *BC.getIOAddressMap ().lookup (BB->getInputOffset () + getAddress ());
4132
+ // Injected functions likely will fail lookup, as they have no
4133
+ // input range. Just assign the BB the output address of the
4134
+ // function.
4135
+ auto MaybeBBAddress =
4136
+ BC.getIOAddressMap ().lookup (BB->getInputOffset () + getAddress ());
4137
+ const uint64_t BBAddress = MaybeBBAddress ? *MaybeBBAddress
4138
+ : BB->isSplit () ? FF.getAddress ()
4139
+ : getOutputAddress ();
4134
4140
BB->setOutputStartAddress (BBAddress);
4135
4141
4136
4142
if (PrevBB)
Original file line number Diff line number Diff line change
1
+ // Checking crashes against injected binary functions created by patch
2
+ // entries pass and debug info turned on. In these cases, we were
3
+ // trying to fetch input to output maps on injected functions and
4
+ // crashing.
5
+
6
+ // REQUIRES: system-linux
7
+
8
+ // RUN: %clang %cflags -no-pie -g %s -fuse-ld=lld -o %t.exe -Wl,-q
9
+ // RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections \
10
+ // RUN: --force-patch
11
+
12
+ #include <stdio.h>
13
+
14
+ static void foo () { printf ("foo\n" ); }
15
+
16
+ int main () {
17
+ foo ();
18
+ return 0 ;
19
+ }
You can’t perform that action at this time.
0 commit comments