This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Introduce an Output class to wrap the output stream creation (NFC)
ClosedPublic

Authored by mehdi_amini on Aug 15 2016, 11:00 PM.

Details

Summary

While NFC for now, this will allow more flexibility on the client side
to hold state necessary to back up the stream.
Also when adding caching, this class will grow in complexity.

Note I blindly modified the gold-plugin as I can't compile it.

Diff Detail

Repository
rL LLVM

Event Timeline

mehdi_amini retitled this revision from to [LTO] Introduce an Output class to wrap the output stream creation (NFC).
mehdi_amini updated this object.
mehdi_amini added a reviewer: tejohnson.
mehdi_amini added a subscriber: llvm-commits.

Missed a few renaming

davide added a subscriber: davide.Aug 16 2016, 10:51 AM
tejohnson edited edge metadata.Aug 16 2016, 11:06 AM

Looks ok, let me download the patch and try with gold though. Will get back later today.

include/llvm/LTO/LTO.h
235 ↗(On Diff #68135)

Maybe "NativeObjectOutput" or something like that to make it clear - one thing I would like to change eventually is the fact that this callback is passed to the WriteIndexesThinBackend, which doesn't write a native object file.

Looks ok to me. I can't test the gold plugin easily (I'm on my macbook laptop without access to a Linux machine) either.

mehdi_amini edited edge metadata.Aug 16 2016, 12:33 PM
mehdi_amini added a subscriber: pcc.

Building gold-plugin exposed a couple issues, one of which will require some changes to interface.

tools/gold/gold-plugin.cpp
657 ↗(On Diff #68135)

FD was not declared, which exposes an issue - the interface needs to handle this being a temp file that we create here.

732 ↗(On Diff #68135)

Needs a ';' at end

Fix gold-plugin build

tools/gold/gold-plugin.cpp
657 ↗(On Diff #68135)

Does it? Can't we just not create the file open?

Will give the changes a try and report back.

tools/gold/gold-plugin.cpp
657 ↗(On Diff #68135)

Ah, yes, that should be fine. Missed the fact that createTemporaryFile will return the new filename.

Do you have a companion clang change? BackendUtil.cpp needs an update for the new arg to thinBackend.

Rename to NativeObjectOutput and move declaration to Config.h

tejohnson accepted this revision.Aug 16 2016, 3:07 PM
tejohnson edited edge metadata.

Confirmed that this builds and tests file with gold.

This revision is now accepted and ready to land.Aug 16 2016, 3:07 PM
mehdi_amini marked 5 inline comments as done.Aug 16 2016, 11:30 PM
This revision was automatically updated to reflect the committed changes.