[PATCH] D72197: [MC][ELF] Emit a relocation if target is defined in the same section and is non-local

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 04:07:03 PST 2020


peter.smith added a comment.

I'm not sure of the history of LLVM policy on this. I note that as of today it is possible to get different program behaviour (either performance regressions due to extra PLT entries, or interposing) with -ffunction-sections and without as there will always be a relocation for a branch to another global STT_FUNC symbol with -ffunction-sections as it will be in a different section.

As well as thumb2-beq-fixup.s the Thumb-1 branch and conditional branch relocations will be affected.

          .syntax unified
          .text
          .thumb
          .global foo
  foo:
          b.n foo
          beq.n foo

These will now generate, like GNU as:

  00000000 <foo>:
     0:   e7fe            b.n     0 <foo>
                          0: R_ARM_THM_JUMP11     foo
     2:   d0fe            beq.n   0 <foo>
                          2: R_ARM_THM_JUMP8      foo

There is an existing test thumb1-branch-reloc.s for these but it only tests external symbols, may be worth adding a global defined in the section.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72197/new/

https://reviews.llvm.org/D72197





More information about the llvm-commits mailing list