[PATCH] D47098: [ELF] Support R_X86_64_GOTPC{32,64}

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 1 12:13:31 PDT 2018


grimar added a comment.

In https://reviews.llvm.org/D47098#1119247, @MaskRay wrote:

> This revision is independent from https://reviews.llvm.org/D47507 though only with both we can make the following assembly sequence work no matter the value of _GLOBAL_OFFSET_TABLE_:
>
>   // -mcmodel=medium
>   // extern long _DYNAMIC[] __attribute__((visibility("hidden")));
>   // long* foo() {
>   //   return _DYNAMIC;
>   // }
>  
>   	leaq	_GLOBAL_OFFSET_TABLE_(%rip), %rdx
>   	movabsq	$_DYNAMIC at GOTOFF, %rax
>
>
> Does this cleaned-up revision look good? (The changes to relocation calculation have been removed)


That is true that this revision is technically independent, but personally, I would like to wait for https://reviews.llvm.org/D47507 landing because:

1. We can use single asm test (and not yaml2obj) then.
2. We can explicitly add a check for input objects to ensure them have relocations we expect. And so to verify we have no known

cases when LLD produce broken output.



================
Comment at: test/ELF/x86-64-reloc-got.s:6
+
+// 0x3070 (.got end) - 0x1000 = 8304
+
----------------
This should have a proof. So you should dump a .got section to show that .got address + its size == 0x3070.
Please see another our tests, they have a lot of samples.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47098





More information about the llvm-commits mailing list