This is an archive of the discontinued LLVM Phabricator instance.

ananas: Add shared library support
ClosedPublic

Authored by zhmu on Dec 21 2017, 10:07 AM.

Details

Summary

The Ananas Operating System (https://github.com/zhmu/ananas) has shared library support as of commit 57739c0b6ece56dd4872aedf30264ed4b9412c77.

This change adds the necessary settings to clang so that shared executables and libraries can be build correctly.

Diff Detail

Repository
rC Clang

Event Timeline

zhmu created this revision.Dec 21 2017, 10:07 AM
ed added inline comments.Dec 27 2017, 6:39 AM
lib/Driver/ToolChains/Ananas.cpp
93–97

This logic is used multiple times. Would it make sense to do something like this?

bool IsShared = Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie);
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(IsShared ? "crtbeginS.o" : "crtbegin.o")));
117–120
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(IsShared ? "crtendS.o" : "crtend.o")));
zhmu added a comment.Dec 29 2017, 10:28 AM

@ed I tried to keep things as much in line as the other <os>::linker::Construct() functions do. Do you wish to stray from that path?

I actually prefer to keep it like this as it's quite readable already, but YMMV of course :-)

ed accepted this revision.Jan 9 2018, 12:43 AM
In D41500#965157, @zhmu wrote:

@ed I tried to keep things as much in line as the other <os>::linker::Construct() functions do. Do you wish to stray from that path?

I actually prefer to keep it like this as it's quite readable already, but YMMV of course :-)

Agreed. I'll commit this patch later today as is!

This revision is now accepted and ready to land.Jan 9 2018, 12:43 AM
This revision was automatically updated to reflect the committed changes.