[PATCH] D50234: [LLD][ELF][ARM] Test undefined weak symbol for Thumb narrow branch

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 3 03:03:54 PDT 2018


peter.smith created this revision.
peter.smith added reviewers: ruiu, grimar.
Herald added subscribers: chrib, kristof.beyls, arichardson, emaste.
Herald added a reviewer: javed.absar.
Herald added a reviewer: espindola.

Add a test for the R_ARM_THM_JUMP11 relocation to an undefined symbol. We have to use a binary object assembled with the GNU assembler as llvm-mc relaxes the narrow branch to a b.w which uses the R_ARM_THM_JUMP24 relocation.

This adds code coverage for a line introduced in https://reviews.llvm.org/D26240


https://reviews.llvm.org/D50234

Files:
  test/ELF/Inputs/arm-thumb-narrow-undefined-weak.o
  test/ELF/arm-thumb-undefined-weak-narrow.s


Index: test/ELF/arm-thumb-undefined-weak-narrow.s
===================================================================
--- /dev/null
+++ test/ELF/arm-thumb-undefined-weak-narrow.s
@@ -0,0 +1,19 @@
+// REQUIRES: arm
+// RUN: ld.lld %S/Inputs/arm-thumb-narrow-undefined-weak.o -o %t
+// RUN: llvm-objdump -triple=thumbv7a-linux-gnueabi -d %t | FileCheck %s
+
+// CHECK: Disassembly of section .text:
+// CHECK-NEXT: __start:
+// CHECK-NEXT:    11000:       ff e7   b       #-2
+
+// llvm-mc relaxes the b.n to a b.w as undefined_weak is external to the
+// section so we must use a binary object produced by GNU as using the 
+// following assembly
+
+//        .thumb
+//        .syntax unified
+//
+//        .weak undefined_weak
+//        .globl _start
+//        .type _start, %function
+// __start: b.n undefine_weak


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50234.158959.patch
Type: text/x-patch
Size: 820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/0d203279/attachment.bin>


More information about the llvm-commits mailing list