[PATCH] D20024: [ELF] - Protect first entries of got.plt with RelRo.

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 16:09:22 PDT 2016


On Fri, May 06, 2016 at 03:37:28PM -0700, Rui Ueyama wrote:
> Does that mean the value the static linker writes to the first GOT slot
> will be ignored?

        leaq    _GLOBAL_OFFSET_TABLE_(%rip),%rax
        leaq    _DYNAMIC(%rip),%rdi     # &_DYNAMIC
        movq    %rdi,%rbx
        subq    (%rax),%rbx             # relocbase

...and %rbx is then passed as argument to the self-relocation function.
There are some possible other ways to do it, but they are more involved
like parsing the aux vector. Given that this is very early startup code,
less magic is better here.

Joerg


More information about the llvm-commits mailing list