Page MenuHomePhabricator

Set DF_TEXTREL instead of creating an empty DT_TEXTREL.
ClosedPublic

Authored by ruiu on Feb 28 2018, 4:41 PM.

Details

Summary

Generic ABI as of 2000 [1] mentioned that "Its [DT_TEXTREL's] use
has been superseded by the DF_TEXTREL flag". We currently create only
DT_TEXTREL and don't set the DF_TEXTREL flag.

This patch is to let the linker to set the flag instead of creating
a DT_TEXTREL marker segment.

With this patch, lld no longer emits DT_TEXTREL. I believe that's not
an issue because it is a very old option and text relocation is rare.
If you want to keep it, we can set both DT_TEXTREL and DF_TEXTREL though.
But I'm not comfortable with supporting only the old way.

[1] http://www.sco.com/developers/gabi/2000-07-17/ch5.dynamic.html

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

ruiu created this revision.Feb 28 2018, 4:41 PM

The FreeBSD rtld supports both so this LGTM. Emitting both is probably more compatible but I'm not sure it's required. What does ld.bfd do?

ruiu added a comment.Mar 1 2018, 10:03 AM

GNU linkers seem to emit both since perhaps almost 20 years ago. I'm actually fine with emitting both, but since we've had such an extremely long transition period, I'd like to emit just DF_TEXTREL if all OSes are OK with that.

ruiu updated this revision to Diff 136607.Mar 1 2018, 2:28 PM
  • restore code to create DT_TEXTREL
This revision was not accepted when it landed; it landed in state Needs Review.Mar 1 2018, 2:59 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.

As @rafael noticed in a follow-up by mail, OpenBSD doesn't implement support for DF_TEXTREL. I don't see a reason why we couldn't so I've implemented support and expect it to be committed before OpenBSD 6.3 is released.

Thanks!

Mark Kettenis via Phabricator <reviews@reviews.llvm.org> writes:

kettenis added a comment.

As @rafael noticed in a follow-up by mail, OpenBSD doesn't implement support for DF_TEXTREL. I don't see a reason why we couldn't so I've implemented support and expect it to be committed before OpenBSD 6.3 is released.

Repository:

rLLD LLVM Linker

https://reviews.llvm.org/D43920