[llvm-bugs] [Bug 38435] New: [ARM]

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 2 16:30:16 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38435

            Bug ID: 38435
           Summary: [ARM]
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: japaricious at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20635
  --> https://bugs.llvm.org/attachment.cgi?id=20635&action=edit
Output of --reproduce

These are the input object files. Observe the instruction at <main+0x2>: `bl
<__nop>`.

    $ arm-none-eabi-objdump -Cd app.o | head -n11

    app.o:     file format elf32-littlearm


    Disassembly of section .text.main:

    00000000 <main>:
      0:   be00            bkpt    0x0000
      2:   f7ff fffe       bl      0 <__nop>
      6:   be00            bkpt    0x0000
      8:   e7fd            b.n     6 <main+0x6>

    $ arm-none-eabi-objdump -Cd libasm.a
    In archive libasm.a:

    asm.o:     file format elf32-littlearm


    Disassembly of section .text:

    00000000 <__nop>:
      0:   4770            bx      lr

When linking with LLD, <main+0x2> becomes `blx 8000050`. This instruction
causes a HardFault (SIGILL like) exception when executed. (AIUI the argument of
BLX should be a register, not an address)

    $ lld -flavor gnu app.o -o app --gc-sections -L . -Bstatic --whole-archive
-lasm --no-whole-archive -Tlink.x -Bdynamic --reproduce repro.tar

    $ arm-none-eabi-objdump -Cd app | head -n11

    app:     file format elf32-littlearm


    Disassembly of section .text:

    08000040 <main>:
    8000040:       be00            bkpt    0x0000
    8000042:       f000 e806       blx     8000050 <DefaultExceptionHandler>
    8000046:       be00            bkpt    0x0000
    8000048:       e7fd            b.n     8000046 <main+0x6>

When linking with GNU LD, <main+0x2> becomes `bl 8000052`. This program
executes without raising an exception.

    $ arm-none-eabi-ld app.o -o app --gc-sections -L . -Bstatic --whole-archive
-lasm --no-whole-archive -Tlink.x -Bdynamic

    $ arm-none-eabi-objdump -Cd app | head -n11

    app:     file format elf32-littlearm


    Disassembly of section .text:

    08000040 <main>:
    8000040:       be00            bkpt    0x0000
    8000042:       f000 f806       bl      8000052 <__nop>
    8000046:       be00            bkpt    0x0000
    8000048:       e7fd            b.n     8000046 <main+0x6>

Version information:

LLVM:
https://github.com/llvm-mirror/llvm/commit/0b5d0cfa8e55ac076285efb25e102597751db49c
LLD:
https://github.com/llvm-mirror/lld/commit/bcfc39dfc8e40fd7744828abfb4ae4f9e69dc32b
GNU LD: 2.31

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180802/c2384d4e/attachment.html>


More information about the llvm-bugs mailing list