This is an archive of the discontinued LLVM Phabricator instance.

Add "PIE Level" metadata to module flags
ClosedPublic

Authored by tmsriram on Apr 28 2016, 10:18 AM.

Details

Reviewers
davidxl
rnk
Summary

Currently, with -fPIC,

We see this:

!llvm.module.flags = !{!0}
!0 = !{i32 1, !"PIC Level", i32 2}

and module.getPICLevel() is used to query PIC. I am doing the same for PIE.

I will follow this up with patches to:

  • Set PIE Level in LLVM in Clang and delete llvm::TargetOptions::PositionIndependentExecutable target member.
  • Use Module::getPIELevel to check for PIE.

Diff Detail

Event Timeline

tmsriram updated this revision to Diff 55435.Apr 28 2016, 10:18 AM
tmsriram retitled this revision from to Add "PIE Level" metadata to module flags.
tmsriram updated this object.
tmsriram added reviewers: rnk, davidxl.
tmsriram added a subscriber: llvm-commits.
rnk accepted this revision.Apr 28 2016, 10:28 AM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Apr 28 2016, 10:28 AM

Out of curiosity. What is the relationship of this and

enum Model { Default, Static, PIC_, DynamicNoPIC };

Is the enum something we should deprecate and eventually remove? The
medata is used only on The powerpc backend right now.

Cheers,
Rafael