[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 04:20:09 PDT 2018


peter.smith updated this revision to Diff 158974.
peter.smith added a comment.

I've updated the comment to mention the gcc version. The code for the object is in the comment, I've made that a bit clearer.

Will wait till Monday to give Rui a chance to take a look.


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,21 @@
+// 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. It can be
+// reproduced with arm-linux-gnueabihf-gcc -c filename.s -o filename.o where
+// filename.s contains the code below. The object in Inputs was produced
+// by arm-linux-gnueabihf-gcc (Linaro GCC 5.3-2016.02) 5.3.1 20160113
+//
+//        .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.158974.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/5c7894ab/attachment.bin>


More information about the llvm-commits mailing list