[PATCH] D72892: [MC][ARM] Resolve some pcrel fixups at assembly time

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 12:29:27 PST 2020


MaskRay added a comment.

In D72892#1900702 <https://reviews.llvm.org/D72892#1900702>, @strejda wrote:

> I had a very long answer, but just before sending it, I deleted it. We should return to beginning.
>
> I saying that ‘ .globl foo; foo: adr r0, foo" is absolutely valid code if is used in statically compiled executable.
>  By words, is absolutely OK to take reference to global symbol by 'adr' pseudo instruction if given object is linked to pure static environment.
>
> You saying that this code snippet is undefined. So imagine I'm an absolute newcomer and tell me exactly why it's wrong and what isn't exactly defined.
>  If you give me single real evidence I'll apologize and immediately send the patch to FreeBSD.
>
> I hope that this is fair offer right?
>
> And only FYI :
>  https://lists.gnu.org/archive/html/bug-binutils/2015-06/msg00074.html
>  https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6855/1
> Michal


So, in GNU as, resolving the fixup (both GNU as and LLVM MC use the term "fixup") is only done when the relocation and the definition are in the same section.

  adr r0, cp15_save_power
  
  .section .text.foo,"ax"
  .globl cp15_save_power
  cp15_save_power:
  
  # GNU as: Error: undefined symbol cp15_save_power used as an immediate value
  # Current llvm-mc: Resolved the fixup


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72892





More information about the llvm-commits mailing list