This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Take elf_common.c as a interface library
ClosedPublic

Authored by tianshilei1992 on Jan 11 2021, 12:37 PM.

Details

Summary

For now elf_common.c is taken as a common part included into
different plugin implementations directly via
#include "../../common/elf_common.c", which is not a best practice. Since it
is simple enough such that we don't need to create a real library for it, we just
take it as a interface library so that other targets can link it directly. Another
advantage of this method is, we don't need to add the folder into header search
path which can potentially pollute the search path.

VE and AMD platforms have not been tested because I don't have target machines.

Diff Detail

Event Timeline

tianshilei1992 requested review of this revision.Jan 11 2021, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2021, 12:37 PM

Fixed wrong comments

Yep, that looks like it'll work. The included source is a good thing to get rid of. Did you consider a header only library instead? There isn't much code in elf_common and we already know the headers work in the various rtl.cpp

Yep, that looks like it'll work. The included source is a good thing to get rid of. Did you consider a header only library instead? There isn't much code in elf_common and we already know the headers work in the various rtl.cpp

Actually an interface library is the way in CMake to implement a header only library. :-)

JonChesterfield accepted this revision.Jan 11 2021, 12:44 PM

Ah, missed that. I thought you were building an archive.

This is better than adding a depends clause on the header to each plugin. Lends itself to adding more common code over time too. Very good, thanks!

This revision is now accepted and ready to land.Jan 11 2021, 12:44 PM
This revision was landed with ongoing or failed builds.Jan 11 2021, 2:34 PM
This revision was automatically updated to reflect the committed changes.

Thanks for this.