This is an archive of the discontinued LLVM Phabricator instance.

[cmake/multilib] Teach llgo to respect the LLVM_LIBDIR_SUFFIX variable for multilib build and installs.
ClosedPublic

Authored by chandlerc on Dec 29 2014, 6:05 AM.

Details

Summary

With this, I get the go subdirectory under the suffixed library which matches
the system's go subdirectory. However, when I run check-llgo everything fails
due to the linker being unable to find libgobegin-llgo or libgo-llgo. It
doesn't seem to be searching the lib64 directory where the libraries are.

Also, there are a *lot* of hard-coded 'lib' references in the gllgo code which
I feel are probably in need of multilib support as well.

So, sending this patch mostly as a starting point for folks to figure out how
to make llgo happy in a multilib world.

Diff Detail

Event Timeline

chandlerc updated this revision to Diff 17670.Dec 29 2014, 6:05 AM
chandlerc retitled this revision from to [cmake/multilib] Teach llgo to respect the LLVM_LIBDIR_SUFFIX variable for multilib build and installs..
chandlerc updated this object.
chandlerc added a subscriber: Unknown Object (MLST).

(added pcc as an explicit reviewer)

pcc edited edge metadata.Dec 29 2014, 6:40 AM

I think the right thing to do is to teach the getVariantDir function in gllgo.go to return an appropriate string (something like "../lib${LLVM_LIBDIR_SUFFIX}[/sanitizer]"). That string should eventually make its way to many of the appropriate places including the libgo build system. That and the initCompiler function looks like everything that needs to be taught about this.

Did you end up exposing LLVM_LIBDIR_SUFFIX somewhere like a #define in a header file? If so, we should be able to pick it up from Go (see e.g. bindings/go/llvm/version.go for an example of how to do that).

Let me know if you have any trouble making changes to the Go code and I'll see if I can take a look at it.

CMakeLists.txt
113

We shouldn't need this change after making my suggested changes.

chandlerc updated this revision to Diff 17677.Dec 29 2014, 2:27 PM
chandlerc edited edge metadata.

Update to reflect a different direction for this suggested by Peter on IRC
where we use a CGO-accessed header file.

Still some debate as to what the right place to put this header file really
is...

pcc accepted this revision.Dec 29 2014, 2:46 PM
pcc edited edge metadata.

LGTM

cmd/gllgo/gllgo.go
64 ↗(On Diff #17677)

The formatting here looks inconsistent, did you run gofmt?

This revision is now accepted and ready to land.Dec 29 2014, 2:46 PM
This revision was automatically updated to reflect the committed changes.