[PATCH] D26239: [LLD][ARM] Do not create interworking thunks for undefined weak references.
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 3 04:59:00 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285896: [ELF] Do not create interworking thunks for undefined weak references. (authored by psmith).
Changed prior to commit:
https://reviews.llvm.org/D26239?vs=76691&id=76841#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26239
Files:
lld/trunk/ELF/Target.cpp
lld/trunk/test/ELF/arm-thumb-no-undefined-thunk.s
Index: lld/trunk/test/ELF/arm-thumb-no-undefined-thunk.s
===================================================================
--- lld/trunk/test/ELF/arm-thumb-no-undefined-thunk.s
+++ lld/trunk/test/ELF/arm-thumb-no-undefined-thunk.s
@@ -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
Index: lld/trunk/ELF/Target.cpp
===================================================================
--- lld/trunk/ELF/Target.cpp
+++ lld/trunk/ELF/Target.cpp
@@ -1652,6 +1652,9 @@
RelExpr ARMTargetInfo::getThunkExpr(RelExpr Expr, uint32_t RelocType,
const InputFile &File,
const SymbolBody &S) const {
+ // If S is an undefined weak symbol we don't need a Thunk
+ if (S.isUndefined())
+ return Expr;
// A state change from ARM to Thumb and vice versa must go through an
// interworking thunk if the relocation type is not R_ARM_CALL or
// R_ARM_THM_CALL.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26239.76841.patch
Type: text/x-patch
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161103/de9c7634/attachment.bin>
More information about the llvm-commits
mailing list