if (using_thumb_only (globals)
&& (r_type == R_ARM_THM_CALL
|| r_type == R_ARM_THM_JUMP24)
- && branch_type == ST_BRANCH_UNKNOWN)
+ && branch_type == ST_BRANCH_UNKNOWN
+ /* Exception to the rule above: a branch to an undefined weak
+ symbol is turned into a jump to the next instruction unless a
+ PLT entry will be created (see below). */
+ && !(h && h->root.type == bfd_link_hash_undefweak
+ && plt_offset == (bfd_vma) -1))
{
if (sym_sec != NULL
&& sym_sec->owner != NULL)
run_dump_test "attr-merge-wchar-44-nowarn"
run_dump_test "farcall-section"
run_dump_test "farcall-missing-type"
+run_dump_test "farcall-missing-type-undefweak"
run_dump_test "attr-merge-unknown-1"
run_dump_test "attr-merge-unknown-2"
run_dump_test "attr-merge-unknown-2r"
--- /dev/null
+ .thumb
+ .cpu cortex-m33
+ .syntax unified
+ .global __start
+ .weak bad
+ .type __start, function
+__start:
+ push {r4, lr}
+ bl bad
+ pop {r4, pc}
--- /dev/null
+#source: farcall-missing-type-main-undefweak.s
+#as:
+#ld:-T farcall-missing-type.ld
+#objdump: -dr
+#...
+Disassembly of section .text:
+
+.* <__start>:
+ +[0-9a-f]+: .... .... push {r4, lr}
+ +[0-9a-f]+: .... .... nop.w
+ +[0-9a-f]+: .... .... pop {r4, pc}