[PATCH] D14567: [ELF2] - dont merge .data.rel.ro/.data.rel.ro.local into .data section.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 09:27:01 PST 2015


The logic behind .data.rel.ro is simple: The compiler knows that any
data in it is read only once the dynamic linker is done.

For .data.rel.ro.local things are not as simple. It was created to
support prelinking. The idea was to

* Put in .data.rel.ro.local data that is ro once the dynamic linker is
done and whose relocations resolve to the same DSO.
* Have a prelink program assign addresses to the DSOs and resolve the
relocations in .data.rel.ro.local.

There are a few things that are bad with this

* There are ways of speeding up DSOs that don't compromise security.
* The linker knows if a reloattion will always refer to the same DSO
or not, so having the compiler pass that down seems redundant.
* The prelinker seems dead. It has removed from fedora after failing
to build for two releases:
http://pkgs.fedoraproject.org/cgit/prelink.git/commit/?id=eb43100a8331d91c801ee3dcdb0a0bb9babfdc1f

As for the patch, it would also have been incomplete, since it was not
putting the .local sections in a contiguous range.

My suggestion then is:

* Map ".data.rel.ro.*" to ".data.rel.ro". That is, fully ignore the .local part.
* Drop prelink support from llvm (I am writing the patch).

Cheers,
Rafael



On 12 November 2015 at 10:48, George Rimar <grimar at accesssoftek.com> wrote:
> grimar added a comment.
>
> If the main aim to make code shorter then I would suggest next one.
>
>   if (S.startswith(".data.rel.ro")
>     return ".data.rel.ro";
>
> The only point to have this sections in output is to split the rw .data to read only part + smaller rw .data for Relro. There are probably no reasons to keep both .data.rel.ro and .data.rel.ro.local for that. Except behavior consistency with gold of-cource.
>
>
> http://reviews.llvm.org/D14567
>
>
>


More information about the llvm-commits mailing list