This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Rework the object build support
ClosedPublic

Authored by phosek on Apr 30 2019, 5:33 PM.

Details

Summary

The initial implementation didn't properly support cross-compilation
via the runtime build, the updated implementation should address that
by expanding the CMAKE_C_COMPILE_OBJECT variable with correct values.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Apr 30 2019, 5:33 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 30 2019, 5:33 PM
Herald added subscribers: llvm-commits, Restricted Project, mgorny, dberris. · View Herald Transcript

This is really nasty, but I'm not sure if there's a better way to do this.

compiler-rt/cmake/Modules/AddCompilerRT.cmake
278 ↗(On Diff #197489)

I think you mean "CMake 3.9" and not "LLVM 3.9" :)

278 ↗(On Diff #197489)

Is it okay to drop this part? I don't know how common it is to set COMPILE_FLAGS on sources.

304 ↗(On Diff #197489)

Would separate_arguments be better here, to handle quoted arguments etc. correctly? (Though I guess the string(REPLACE) on line 282 is potentially screwing up quoted arguments anyway.)

phosek updated this revision to Diff 197494.Apr 30 2019, 6:12 PM
phosek marked 6 inline comments as done.
phosek added inline comments.Apr 30 2019, 7:02 PM
compiler-rt/cmake/Modules/AddCompilerRT.cmake
278 ↗(On Diff #197489)

I don't think it's very often, but I'm fine including it.

278 ↗(On Diff #197489)

Yes, but after looking into it a bit I realized that this may not be enough since CMake doesn't allow specifying output names for object libraries so I deleted the comment.

304 ↗(On Diff #197489)

It seems to be working.

beanz accepted this revision.Apr 30 2019, 7:31 PM

This all looks reasonable to me. It is kinda frustrating that CMake doesn't support any way to control the output name of an object file, or even the install name of one. I suspect that is probably because some of CMake's generation targets (like Xcode) don't give CMake explicit control over output object file names.

This revision is now accepted and ready to land.Apr 30 2019, 7:31 PM
This revision was automatically updated to reflect the committed changes.