[LLVMbugs] [Bug 22999] New: We can emit unlinkable object files when compiling large modules on (at least) ARM

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 23 11:06:58 PDT 2015


            Bug ID: 22999
           Summary: We can emit unlinkable object files when compiling
                    large modules on (at least) ARM
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: peter at pcc.me.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

On ARM, if the compiled size of the .text section exceeds 32MB (the maximum
call displacement), the linker will not necessarily be able to resolve
relocations for the calls. The below asm file illustrates the problem (it is
also possible to reproduce in IR, but the reproduction is too large for here.)

$ cat call-range-l.s
.zero 100000000
.global foo
bl bar
.zero 100000000
.section        .text._Z1fv,"axG",%progbits,_Z1fv,comdat
.global bar
$ ~/src/llvm-build-rel/bin/llvm-mc -filetype=obj -o call-range-l.o
call-range-l.s -triple armv7
$ ~/src/binutils-gdb-inst-arm/bin/ld.bfd -m armelf_linux_eabi -e foo
call-range-l.o: In function `foo':
(.text+0x5f5e100): relocation truncated to fit: R_ARM_CALL against symbol `bar'
defined in .text._Z1fv[_Z1fv] section in call-range-l.o
$ ~/src/binutils-gdb-inst-arm/bin/ld.gold -m armelf_linux_eabi -e foo
.../src/binutils-gdb-inst-arm/bin/ld.gold: internal error in arm_branch_common,
at ../../binutils-gdb/gold/arm.cc:4014

This problem particularly comes up when using LTO.

An easy way to solve the problem would be to teach the LTO backend to use
-function-sections on architectures where this matters (e.g. ARM), if we're
comfortable with the assumption that only LTO can create objects with .text
sections that large. It may also be possible for the backend to do something
smarter based on the computed size of .text.

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/20150323/08f8289a/attachment.html>

More information about the llvm-bugs mailing list