Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] Do not create interworking thunks for undefined weak references.
An undefined weak reference is given an address of 0 this will incorrectly trigger the creation of a Thumb to ARM interworking Thunk if there is a Thumb branch instruction to the symbol. This results in an error as Thunks only make sense to defined or shared symbols. We prevent this by detecting an undefined symbol and not creating a thunk for it. Differential Revision: https://reviews.llvm.org/D26239 llvm-svn: 285896
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t | ||
// RUN: ld.lld %t -o %t2 2>&1 | ||
// RUN: llvm-objdump -triple=thumbv7a-none-linux-gnueabi -d %t2 | FileCheck %s | ||
// REQUIRES: arm | ||
|
||
// Check that no thunks are created for an undefined weak symbol | ||
.syntax unified | ||
|
||
.weak target | ||
|
||
.section .text.thumb, "ax", %progbits | ||
.thumb | ||
.global | ||
_start: | ||
bl target | ||
b target | ||
b.w target | ||
|
||
// CHECK: Disassembly of section .text: | ||
// CHECK-NEXT: _start: | ||
// CHECK-NEXT: 11000: ee f7 fe ef blx #-69636 | ||
// CHECK-NEXT: 11004: ee f7 fc bf b.w #-69640 | ||
// CHECK-NEXT: 11008: ee f7 fa bf b.w #-69644 |