[LLD][ELF] - Do not produce an invalid dynamic relocation order with --shuffle-sections.
authorGeorgii Rymar <grimar@accesssoftek.com>
Mon, 10 Aug 2020 14:00:53 +0000 (17:00 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Mon, 17 Aug 2020 11:46:52 +0000 (14:46 +0300)
commitc135a68d426fd69d26454658bfa62102993f12a7
tree7715f1b6dc976ed77f5ccad2ee95de02220a0407
parent7e6c437fb413eb7ae102e8db869bb55a748411ff
[LLD][ELF] - Do not produce an invalid dynamic relocation order with --shuffle-sections.

Normally (when not on android with android relocation packing enabled),
we put IRelative relocations to ".rel[a].dyn", after other relocations,
to ensure that IRelatives are processed last by the dynamic loader.

To achieve that we add the `in.relaIplt` after the `part.relaDyn`:
https://github.com/llvm/llvm-project/blob/master/lld/ELF/Writer.cpp#L540

The problem is that `--shuffle-sections` might break the sections order.
This patch fixes it.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47056.

Differential revision: https://reviews.llvm.org/D85651
lld/ELF/Writer.cpp
lld/test/ELF/gnu-ifunc-plt.s