[llvm-bugs] [Bug 40624] New: -mlong-calls generates non-PIC code on ARM

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 6 00:01:29 PST 2019


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

            Bug ID: 40624
           Summary: -mlong-calls generates non-PIC code on ARM
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mh+llvm at glandium.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

With the following source:
```
extern __attribute__((visibility("hidden"))) int foo();

int bar() { return foo(); };
```

clang generates the following with -fPIC -mlong-calls -O3
--target=armv7a-linux-gnueabi:
```
bar:
        ldr     r0, .LCPI0_0
        bx      r0
.LCPI0_0:
        .long   foo
```

That is not PIC, as that .LCPI0_0 label is in .text.

GCC generates the following:
```
bar:
        ldr     r3, .L3
.LPIC0:
        add     r3, pc, r3
        bx      r3
.L3:
        .word   foo-(.LPIC0+8)
```

(All courtesy of godbolt)

https://godbolt.org/z/gKwbiO

-- 
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/20190206/4ac46503/attachment.html>


More information about the llvm-bugs mailing list