[mach-o] for 32-bit arm, in -r mode support B (not BL) to undefined symbol
authorNick Kledzik <kledzik@apple.com>
Tue, 18 Nov 2014 22:08:50 +0000 (22:08 +0000)
committerNick Kledzik <kledzik@apple.com>
Tue, 18 Nov 2014 22:08:50 +0000 (22:08 +0000)
When fixing up BL instructions, the linker has to compare the thumbness of the
target to decide if the instruction needs to be converted to BLX.  But with B
instruction there is no BX, so the linker asserts if the target is not the
same thumbness. This assert was firing in -r mode when the target was undefined
which it interpreted as being non-thumb.

Test case change is to add a B (in both thumb and arm code) to an undefined
symbol and round trip through -r mode.

llvm-svn: 222266

lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
lld/test/mach-o/parse-arm-relocs.yaml

index 3e74d7b..ca8180e 100644 (file)
@@ -1074,6 +1074,7 @@ void ArchHandler_arm::applyFixupRelocatable(const Reference &ref, uint8_t *loc,
   int32_t displacement;
   uint16_t value16;
   uint32_t value32;
+  bool targetIsUndef = isa<UndefinedAtom>(ref.target());
   switch (ref.kindValue()) {
   case modeThumbCode:
     thumbMode = true;
@@ -1091,7 +1092,8 @@ void ArchHandler_arm::applyFixupRelocatable(const Reference &ref, uint8_t *loc,
     else
       displacement = (targetAddress - (fixupAddress + 4)) + ref.addend();
     value32 = setDisplacementInThumbBranch(*loc32, fixupAddress,
-                                           displacement, targetIsThumb);
+                                           displacement,
+                                           targetIsUndef || targetIsThumb);
     *loc32 = value32;
     break;
   case thumb_movw:
index a9d008d..c87c2a9 100644 (file)
@@ -1,5 +1,5 @@
-# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t  | FileCheck %s \
-# RUN: && lld -flavor darwin -arch armv7 -r -print_atoms %t -o %t2  | FileCheck %s
+# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t   | FileCheck %s
+# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %t -o %t2  | FileCheck %s
 #
 # Test parsing of armv7 relocations.
 #
@@ -9,8 +9,6 @@
 arch:            armv7
 file-type:       MH_OBJECT
 flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
-has-UUID:        false
-OS:              unknown
 sections:
   - segment:         __TEXT
     section:         __text
@@ -18,27 +16,28 @@ sections:
     attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
     alignment:       2
     address:         0x0000000000000000
-    content:         [ 0x00, 0xF0, 0x4A, 0xF8, 0x00, 0xF0, 0x4A, 0xF8, 
-                       0xFF, 0xF7, 0xFA, 0xFF, 0xFF, 0xF7, 0xFA, 0xFF, 
-                       0x40, 0xF2, 0x6E, 0x01, 0xC0, 0xF2, 0x00, 0x01, 
-                       0x40, 0xF2, 0x76, 0x02, 0xC0, 0xF2, 0x00, 0x02, 
-                       0x40, 0xF2, 0x29, 0x01, 0xC0, 0xF2, 0x00, 0x01, 
-                       0x79, 0x44, 0x40, 0xF2, 0x98, 0x03, 0xC0, 0xF2, 
-                       0x00, 0x03, 0x40, 0xF2, 0xA0, 0x04, 0xC0, 0xF2, 
-                       0x00, 0x04, 0x40, 0xF2, 0x53, 0x03, 0xC0, 0xF2, 
-                       0x00, 0x03, 0x40, 0xF2, 0x00, 0x05, 0xC0, 0xF2, 
-                       0x00, 0x05, 0x40, 0xF2, 0x08, 0x06, 0xC0, 0xF2, 
-                       0x00, 0x06, 0xC0, 0x46, 0x0F, 0x00, 0x00, 0xEB, 
-                       0x0F, 0x00, 0x00, 0xEB, 0xE7, 0xFF, 0xFF, 0xEB, 
-                       0xE7, 0xFF, 0xFF, 0xEB, 0x20, 0x10, 0x00, 0xE3, 
-                       0x00, 0x10, 0x40, 0xE3, 0x28, 0x20, 0x00, 0xE3, 
-                       0x00, 0x20, 0x40, 0xE3, 0x0F, 0x10, 0x81, 0xE0, 
-                       0x98, 0x30, 0x00, 0xE3, 0x00, 0x30, 0x40, 0xE3, 
-                       0xA0, 0x40, 0x00, 0xE3, 0x00, 0x40, 0x40, 0xE3, 
-                       0x00, 0x50, 0x00, 0xE3, 0x00, 0x50, 0x40, 0xE3, 
+    content:         [ 0x00, 0xF0, 0x4E, 0xF8, 0x00, 0xF0, 0x4E, 0xF8,
+                       0xFF, 0xF7, 0xFA, 0xFF, 0xFF, 0xF7, 0xFA, 0xFF,
+                       0xFF, 0xF7, 0xF6, 0xBF, 0x40, 0xF2, 0x72, 0x01,
+                       0xC0, 0xF2, 0x00, 0x01, 0x40, 0xF2, 0x7A, 0x02,
+                       0xC0, 0xF2, 0x00, 0x02, 0x40, 0xF2, 0x29, 0x01,
+                       0xC0, 0xF2, 0x00, 0x01, 0x79, 0x44, 0x40, 0xF2,
+                       0xA0, 0x03, 0xC0, 0xF2, 0x00, 0x03, 0x40, 0xF2,
+                       0xA8, 0x04, 0xC0, 0xF2, 0x00, 0x04, 0x40, 0xF2,
+                       0x57, 0x03, 0xC0, 0xF2, 0x00, 0x03, 0x40, 0xF2,
+                       0x00, 0x05, 0xC0, 0xF2, 0x00, 0x05, 0x40, 0xF2,
+                       0x08, 0x06, 0xC0, 0xF2, 0x00, 0x06, 0xC0, 0x46,
+                       0x10, 0x00, 0x00, 0xEB, 0x10, 0x00, 0x00, 0xEB,
+                       0xE6, 0xFF, 0xFF, 0xEB, 0xE6, 0xFF, 0xFF, 0xEB,
+                       0xE4, 0xFF, 0xFF, 0xEA, 0x20, 0x10, 0x00, 0xE3,
+                       0x00, 0x10, 0x40, 0xE3, 0x28, 0x20, 0x00, 0xE3,
+                       0x00, 0x20, 0x40, 0xE3, 0x0F, 0x10, 0x81, 0xE0,
+                       0xA0, 0x30, 0x00, 0xE3, 0x00, 0x30, 0x40, 0xE3,
+                       0xA8, 0x40, 0x00, 0xE3, 0x00, 0x40, 0x40, 0xE3,
+                       0x00, 0x50, 0x00, 0xE3, 0x00, 0x50, 0x40, 0xE3,
                        0x08, 0x60, 0x00, 0xE3, 0x00, 0x60, 0x40, 0xE3 ]
     relocations:
-      - offset:          0x00000094
+      - offset:          0x0000009C
         type:            ARM_RELOC_HALF
         length:          1
         pc-rel:          false
@@ -50,7 +49,7 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000090
+      - offset:          0x00000098
         type:            ARM_RELOC_HALF
         length:          0
         pc-rel:          false
@@ -62,7 +61,7 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000008C
+      - offset:          0x00000094
         type:            ARM_RELOC_HALF
         length:          1
         pc-rel:          false
@@ -74,7 +73,7 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000088
+      - offset:          0x00000090
         type:            ARM_RELOC_HALF
         length:          0
         pc-rel:          false
@@ -86,43 +85,43 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000084
+      - offset:          0x0000008C
         scattered:       true
         type:            ARM_RELOC_HALF
         length:          1
         pc-rel:          false
-        value:           0x00000098
-      - offset:          0x000000A0
+        value:           0x000000A0
+      - offset:          0x000000A8
         type:            ARM_RELOC_PAIR
         length:          1
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000080
+      - offset:          0x00000088
         scattered:       true
         type:            ARM_RELOC_HALF
         length:          0
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         type:            ARM_RELOC_PAIR
         length:          0
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000007C
+      - offset:          0x00000084
         type:            ARM_RELOC_HALF
         length:          1
         pc-rel:          false
         extern:          false
         symbol:          2
-      - offset:          0x00000098
+      - offset:          0x000000A0
         type:            ARM_RELOC_PAIR
         length:          1
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000078
+      - offset:          0x00000080
         type:            ARM_RELOC_HALF
         length:          0
         pc-rel:          false
@@ -134,79 +133,85 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000070
+      - offset:          0x00000078
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          1
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000028
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          1
         pc-rel:          false
-        value:           0x00000078
-      - offset:          0x0000006C
+        value:           0x00000080
+      - offset:          0x00000074
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          0
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          0
         pc-rel:          false
-        value:           0x00000078
-      - offset:          0x00000068
+        value:           0x00000080
+      - offset:          0x00000070
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          1
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000020
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          1
         pc-rel:          false
-        value:           0x00000078
-      - offset:          0x00000064
+        value:           0x00000080
+      - offset:          0x0000006C
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          0
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          0
         pc-rel:          false
-        value:           0x00000078
-      - offset:          0x00000060
+        value:           0x00000080
+      - offset:          0x00000068
         type:            ARM_RELOC_BR24
         length:          2
         pc-rel:          true
         extern:          true
         symbol:          4
-      - offset:          0x0000005C
+      - offset:          0x00000064
         type:            ARM_RELOC_BR24
         length:          2
         pc-rel:          true
         extern:          true
         symbol:          4
-      - offset:          0x00000058
+      - offset:          0x00000060
+        type:            ARM_RELOC_BR24
+        length:          2
+        pc-rel:          true
+        extern:          true
+        symbol:          4
+      - offset:          0x0000005C
         scattered:       true
         type:            ARM_RELOC_BR24
         length:          2
         pc-rel:          true
-        value:           0x00000098
-      - offset:          0x00000054
+        value:           0x000000A0
+      - offset:          0x00000058
         type:            ARM_RELOC_BR24
         length:          2
         pc-rel:          true
         extern:          false
         symbol:          2
-      - offset:          0x0000004E
+      - offset:          0x00000052
         type:            ARM_RELOC_HALF
         length:          3
         pc-rel:          false
@@ -218,7 +223,7 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000004A
+      - offset:          0x0000004E
         type:            ARM_RELOC_HALF
         length:          2
         pc-rel:          false
@@ -230,7 +235,7 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000046
+      - offset:          0x0000004A
         type:            ARM_RELOC_HALF
         length:          3
         pc-rel:          false
@@ -242,7 +247,7 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000042
+      - offset:          0x00000046
         type:            ARM_RELOC_HALF
         length:          2
         pc-rel:          false
@@ -254,19 +259,19 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000003E
+      - offset:          0x00000042
         type:            ARM_RELOC_HALF
         length:          3
         pc-rel:          false
         extern:          false
         symbol:          1
-      - offset:          0x00000053
+      - offset:          0x00000057
         type:            ARM_RELOC_PAIR
         length:          3
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000003A
+      - offset:          0x0000003E
         type:            ARM_RELOC_HALF
         length:          2
         pc-rel:          false
@@ -278,43 +283,43 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000036
+      - offset:          0x0000003A
         scattered:       true
         type:            ARM_RELOC_HALF
         length:          3
         pc-rel:          false
-        value:           0x00000098
-      - offset:          0x000000A0
+        value:           0x000000A0
+      - offset:          0x000000A8
         type:            ARM_RELOC_PAIR
         length:          3
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000032
+      - offset:          0x00000036
         scattered:       true
         type:            ARM_RELOC_HALF
         length:          2
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000002E
+      - offset:          0x00000032
         type:            ARM_RELOC_HALF
         length:          3
         pc-rel:          false
         extern:          false
         symbol:          2
-      - offset:          0x00000098
+      - offset:          0x000000A0
         type:            ARM_RELOC_PAIR
         length:          3
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x0000002A
+      - offset:          0x0000002E
         type:            ARM_RELOC_HALF
         length:          2
         pc-rel:          false
@@ -326,78 +331,84 @@ sections:
         pc-rel:          false
         extern:          false
         symbol:          16777215
-      - offset:          0x00000024
+      - offset:          0x00000028
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          3
         pc-rel:          false
-        value:           0x00000052
+        value:           0x00000056
       - offset:          0x00000028
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          3
         pc-rel:          false
-        value:           0x0000002A
-      - offset:          0x00000020
+        value:           0x0000002E
+      - offset:          0x00000024
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          2
         pc-rel:          false
-        value:           0x00000052
+        value:           0x00000056
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x0000002A
-      - offset:          0x0000001C
+        value:           0x0000002E
+      - offset:          0x00000020
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          3
         pc-rel:          false
-        value:           0x00000098
-      - offset:          0x00000076
+        value:           0x000000A0
+      - offset:          0x0000007A
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          3
         pc-rel:          false
-        value:           0x0000002A
-      - offset:          0x00000018
+        value:           0x0000002E
+      - offset:          0x0000001C
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          2
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x0000002A
-      - offset:          0x00000014
+        value:           0x0000002E
+      - offset:          0x00000018
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          3
         pc-rel:          false
-        value:           0x00000098
-      - offset:          0x0000006E
+        value:           0x000000A0
+      - offset:          0x00000072
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          3
         pc-rel:          false
-        value:           0x0000002A
-      - offset:          0x00000010
+        value:           0x0000002E
+      - offset:          0x00000014
         scattered:       true
         type:            ARM_RELOC_HALF_SECTDIFF
         length:          2
         pc-rel:          false
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x0000002A
+        value:           0x0000002E
+      - offset:          0x00000010
+        type:            ARM_THUMB_RELOC_BR22
+        length:          2
+        pc-rel:          true
+        extern:          true
+        symbol:          4
       - offset:          0x0000000C
         type:            ARM_THUMB_RELOC_BR22
         length:          2
@@ -415,7 +426,7 @@ sections:
         type:            ARM_THUMB_RELOC_BR22
         length:          2
         pc-rel:          true
-        value:           0x00000098
+        value:           0x000000A0
       - offset:          0x00000000
         type:            ARM_THUMB_RELOC_BR22
         length:          2
@@ -426,12 +437,12 @@ sections:
     section:         __data
     type:            S_REGULAR
     attributes:      [  ]
-    address:         0x0000000000000098
+    address:         0x00000000000000A0
     content:         [ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
                        0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-                       0x04, 0x00, 0x00, 0x00, 0xA8, 0xFF, 0xFF, 0xFF, 
-                       0xA8, 0xFF, 0xFF, 0xFF, 0x4D, 0xFF, 0xFF, 0xFF, 
-                       0x4D, 0xFF, 0xFF, 0xFF ]
+                       0x04, 0x00, 0x00, 0x00, 0xA4, 0xFF, 0xFF, 0xFF, 
+                       0xA4, 0xFF, 0xFF, 0xFF, 0x45, 0xFF, 0xFF, 0xFF, 
+                       0x45, 0xFF, 0xFF, 0xFF ]
     relocations:
       - offset:          0x00000020
         scattered:       true
@@ -444,7 +455,7 @@ sections:
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x000000B8
+        value:           0x000000C0
       - offset:          0x0000001C
         scattered:       true
         type:            ARM_RELOC_SECTDIFF
@@ -456,31 +467,31 @@ sections:
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x000000B4
+        value:           0x000000BC
       - offset:          0x00000018
         scattered:       true
         type:            ARM_RELOC_SECTDIFF
         length:          2
         pc-rel:          false
-        value:           0x00000054
+        value:           0x00000058
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x000000B0
+        value:           0x000000B8
       - offset:          0x00000014
         scattered:       true
         type:            ARM_RELOC_SECTDIFF
         length:          2
         pc-rel:          false
-        value:           0x00000054
+        value:           0x00000058
       - offset:          0x00000000
         scattered:       true
         type:            ARM_RELOC_PAIR
         length:          2
         pc-rel:          false
-        value:           0x000000AC
+        value:           0x000000B4
       - offset:          0x00000010
         type:            ARM_RELOC_VANILLA
         length:          2
@@ -514,22 +525,21 @@ local-symbols:
   - name:            _x
     type:            N_SECT
     sect:            2
-    value:           0x0000000000000098
+    value:           0x00000000000000A0
   - name:            _t1
     type:            N_SECT
     sect:            1
     desc:            [ N_ARM_THUMB_DEF ]
-    value:           0x0000000000000052
+    value:           0x0000000000000056
   - name:            _foo_arm
     type:            N_SECT
     sect:            1
-    value:           0x0000000000000054
-undefined-symbols: 
+    value:           0x0000000000000058
+undefined-symbols:
   - name:            _undef
     type:            N_UNDF
     scope:           [ N_EXT ]
     value:           0x0000000000000000
-
 ...
 
 # CHECK:  defined-atoms:
@@ -588,68 +598,72 @@ undefined-symbols:
 # CHECK:          offset:          12
 # CHECK:          target:          _undef
 # CHECK:          addend:          4
-# CHECK:        - kind:            thumb_movw_funcRel
+# CHECK:        - kind:            thumb_b22
 # CHECK:          offset:          16
+# CHECK:          target:          _undef
+# CHECK-NOT:      addend:
+# CHECK:        - kind:            thumb_movw_funcRel
+# CHECK:          offset:          20
 # CHECK:          target:          _x
-# CHECK:          addend:          -42
+# CHECK:          addend:          -46
 # CHECK:        - kind:            thumb_movt_funcRel
-# CHECK:          offset:          20
+# CHECK:          offset:          24
 # CHECK:          target:          _x
-# CHECK:          addend:          -42
+# CHECK:          addend:          -46
 # CHECK:        - kind:            thumb_movw_funcRel
-# CHECK:          offset:          24
+# CHECK:          offset:          28
 # CHECK:          target:          _x
-# CHECK:          addend:          -34
+# CHECK:          addend:          -38
 # CHECK:        - kind:            thumb_movt_funcRel
-# CHECK:          offset:          28
+# CHECK:          offset:          32
 # CHECK:          target:          _x
-# CHECK:          addend:          -34
+# CHECK:          addend:          -38
 # CHECK:        - kind:            thumb_movw_funcRel
-# CHECK:          offset:          32
+# CHECK:          offset:          36
 # CHECK:          target:          _t1
-# CHECK:          addend:          -42
+# CHECK:          addend:          -46
 # CHECK:        - kind:            thumb_movt_funcRel
-# CHECK:          offset:          36
+# CHECK:          offset:          40
 # CHECK:          target:          _t1
-# CHECK:          addend:          -42
+# CHECK:          addend:          -46
 # CHECK:        - kind:            thumb_movw
-# CHECK:          offset:          42
+# CHECK:          offset:          46
 # CHECK:          target:          _x
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            thumb_movt
-# CHECK:          offset:          46
+# CHECK:          offset:          50
 # CHECK:          target:          _x
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            thumb_movw
-# CHECK:          offset:          50
+# CHECK:          offset:          54
 # CHECK:          target:          _x
 # CHECK:          addend:          8
 # CHECK:        - kind:            thumb_movt
-# CHECK:          offset:          54
+# CHECK:          offset:          58
 # CHECK:          target:          _x
 # CHECK:          addend:          8
 # CHECK:        - kind:            thumb_movw
-# CHECK:          offset:          58
+# CHECK:          offset:          62
 # CHECK:          target:          _t1
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            thumb_movt
-# CHECK:          offset:          62
+# CHECK:          offset:          66
 # CHECK:          target:          _t1
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            thumb_movw
-# CHECK:          offset:          66
+# CHECK:          offset:          70
 # CHECK:          target:          _undef
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            thumb_movt
-# CHECK:          offset:          70
+# CHECK:          offset:          74
 # CHECK:          target:          _undef
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            thumb_movw
-# CHECK:          offset:          74
+# CHECK:          offset:          78
 # CHECK:          target:          _undef
 # CHECK:          addend:          8
 # CHECK:        - kind:            thumb_movt
-# CHECK:          offset:          78
+# CHECK:          offset:          82
 # CHECK:          target:          _undef
 # CHECK:          addend:          8
 # CHECK:    - name:            _t1
@@ -676,52 +690,56 @@ undefined-symbols:
 # CHECK:          offset:          12
 # CHECK:          target:          _undef
 # CHECK:          addend:          4
-# CHECK:        - kind:            arm_movw_funcRel
+# CHECK:        - kind:            arm_b24
 # CHECK:          offset:          16
+# CHECK:          target:          _undef
+# CHECK-NOT:      addend:
+# CHECK:        - kind:            arm_movw_funcRel
+# CHECK:          offset:          20
 # CHECK:          target:          _x
-# CHECK:          addend:          -36
+# CHECK:          addend:          -40
 # CHECK:        - kind:            arm_movt_funcRel
-# CHECK:          offset:          20
+# CHECK:          offset:          24
 # CHECK:          target:          _x
-# CHECK:          addend:          -36
+# CHECK:          addend:          -40
 # CHECK:        - kind:            arm_movw_funcRel
-# CHECK:          offset:          24
+# CHECK:          offset:          28
 # CHECK:          target:          _x
-# CHECK:          addend:          -28
+# CHECK:          addend:          -32
 # CHECK:        - kind:            arm_movt_funcRel
-# CHECK:          offset:          28
+# CHECK:          offset:          32
 # CHECK:          target:          _x
-# CHECK:          addend:          -28
+# CHECK:          addend:          -32
 # CHECK:        - kind:            arm_movw
-# CHECK:          offset:          36
+# CHECK:          offset:          40
 # CHECK:          target:          _x
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            arm_movt
-# CHECK:          offset:          40
+# CHECK:          offset:          44
 # CHECK:          target:          _x
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            arm_movw
-# CHECK:          offset:          44
+# CHECK:          offset:          48
 # CHECK:          target:          _x
 # CHECK:          addend:          8
 # CHECK:        - kind:            arm_movt
-# CHECK:          offset:          48
+# CHECK:          offset:          52
 # CHECK:          target:          _x
 # CHECK:          addend:          8
 # CHECK:        - kind:            arm_movw
-# CHECK:          offset:          52
+# CHECK:          offset:          56
 # CHECK:          target:          _undef
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            arm_movt
-# CHECK:          offset:          56
+# CHECK:          offset:          60
 # CHECK:          target:          _undef
 # CHECK-NOT:      addend:
 # CHECK:        - kind:            arm_movw
-# CHECK:          offset:          60
+# CHECK:          offset:          64
 # CHECK:          target:          _undef
 # CHECK:          addend:          8
 # CHECK:        - kind:            arm_movt
-# CHECK:          offset:          64
+# CHECK:          offset:          68
 # CHECK:          target:          _undef
 # CHECK:          addend:          8
 # CHECK:  undefined-atoms: 
@@ -738,6 +756,7 @@ undefined-symbols:
 #  bl    _x+4
 #  bl    _undef
 #  bl    _undef+4
+#  b     _undef
 #  movw        r1, :lower16:(_x-L1)
 #  movt        r1, :upper16:(_x-L1)
 #  movw        r2, :lower16:(_x+8-L1)
@@ -769,6 +788,7 @@ undefined-symbols:
 #  bl    _x+4
 #  bl    _undef
 #  bl    _undef+4
+#  b     _undef
 #  movw        r1, :lower16:(_x-L2)
 #  movt        r1, :upper16:(_x-L2)
 #  movw        r2, :lower16:(_x+8-L2)