[PATCH] D25627: [ELF] Allow linker script to use .got and .got.plt sections as inputs

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 02:17:26 PDT 2016

evgeny777 added a comment.

The reason I'm doing this is that I have same linker script for armv7 and aarch64 and all linkers (gold/ld/lld). This script should enforce two constraints:

1. PLT GOT entries should go before all other GOT entries
2. I need to have start and end symbols for GOT

Both constraints need to be enforced for dynamic loader to work properly. Currently I have something like this in my linker script:

  .got  : { 
     PROVIDE_HIDDEN(__got_start = .);
     *(.got.plt) *(.got) 
     PROVIDE_HIDDEN(__got_end = .);

The problems I face with current version are:

1. On armv7 neither gold nor ld create .got.plt section, but lld does.
2. On aarch64 all linkers create .got.plt, but on some occasions  lld doesn't create .got section, while ld/gold do. Also, even if I specify correct order in linker script sometimes orphan section may be placed in between .got.plt and .got and prevent DSO from being correctly loaded.

BTW it looks like both gold and ld allow placing all linker generated sections wherever you want. May be it makes sense to make this patch more generic?



More information about the llvm-commits mailing list