This is an archive of the discontinued LLVM Phabricator instance.

FYI: a possible fix for pr36678
Needs ReviewPublic

Authored by espindola on Mar 12 2018, 9:06 PM.

Details

Reviewers
ruiu
emaste
Summary

This is a possible fix for pr36678. Having implemented it I now think there is a better way to do it.

What this does is create special plt entries that don't require ebx to be set. That way non pic code can be linker into position independent executable.

The problem I see with this patch is that it is a fairly complicated way of supporting a corner case:.

An alternative that might be simpler is using the thunk infrastructure to create thunks that set ebx and jump to the regular plt entry. We would need to make the preempted symbol point to the thunk.

Yet another option is just producing an error in this situation. If someone really want writable code they can use -z text. I will give this a try. Hopefully there are few cases that depend on this and they can be easily fixed (and they would crash right now anyway).

Diff Detail

Event Timeline

espindola created this revision.Mar 12 2018, 9:06 PM