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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 13:45:56 PST 2017


I took a quick look at BFD linker's source code and I think that is right.
The GNU linker doesn't say anything about text relocations unless "-z text"
or "-warn-shared-textrel" is given.

So, It think what we should do is this:

 - Add "-z textrel" and treat text relocations as an error only when that
option is given, and
 - emit DT_TEXTREL if an output has text relocations.

We don't need to add -warn-shared-textrel at the moment. (We may want it
later, but you want to focus on one thing at a time.)

On Wed, Feb 22, 2017 at 1:38 PM, George Rimar <grimar at accesssoftek.com>
wrote:

> >> So I think the answer is that the GNU linker doesn't warn on text
> relocations at all.
>
> >
>
> >Yes, until I add -z text, which I belive exist exactly for that.
>
> >
> >ld.bfd test.o -shared -o out -z text
> >ld.bfd: test.o: warning: relocation against `_start' in readonly section
> `.text'
> >ld.bfd: read-only segment has dynamic relocations.
> >
>
> >George.
>
>
> In addition they have --warn-shared-textrel for emiting warnings:
>
>
> ld.bfd test.o -shared -o out --warn-shared-textrel
> ld.bfd: test.o: warning: relocation against `_start' in readonly section
> `.text'
> ld.bfd: warning: creating a DT_TEXTREL in a shared object.
>
> George.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170222/24e74a43/attachment.html>


More information about the llvm-commits mailing list