[PATCH] D30256: [ELF] - Implemented -z noreloc-overflow.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 07:19:52 PST 2017


Rui Ueyama <ruiu at google.com> writes:

> Why does it work for other linkers? Do they just allow text relocations by
> default?

And add TEXTREL to the dynamic table.

I don't think we should do it by default, but I am not opposed to
supporting it via a command line option.

Given that the kernel relocates itself, it can set the correct
permissions once it is done. For a regular executable this would require
a copy of the ro segments for each process, but there is normally only
one kernel.

A similar argument holds for kernel modules. Instead of -r I think the
ideal solution would be:

* Compile files so that the code is position independent, but .got/.plt
  is not used (-fPIE?).
* Link with -shared --something-to-allow-ro-relocations.

Cheers,
Rafael


More information about the llvm-commits mailing list