-
Notifications
You must be signed in to change notification settings - Fork 80
Tracking issue: Building and running "standard" go tests compiled with llgo #48
Comments
I'd like to work on this just so that we can verify that all the basics work as expected and if they don't we can start fixing them. Do you have any thoughts about how you'd like to accomplish this? Without doing much research I'm thinking either a custom |
Or actually, adding a new compiler to the regular go command doesn't look that invasive from a quick peek in the sources. |
So I may have misunderstood your previous question. When you say the "standard go tests", are you referring to the top-level "test" directory that lives in the Go source tree (this is what I thought you meant)? Or are you talking about running pkg/testing-based tests (this is what I now think you mean)? I broached the topic of additional compiler support in the I don't think adding another "toolchain" in the go command will fly with the Go team, not with llgo at its current level of maturity at any rate. You'll also nee to update go/build to support resolving package paths (or somehow mangle llgo to conform to what's existing in go/build). It's not ideal, but I think it's probably quicker and easier just to write something customised. llgo-build exists for this reason. |
I wasn't aware of the top level test directory, but that looks like an even better start at this stage. Adding llgo as a toolchain in the go command turned out to be trickier than first assumed so I think the custom tool would be quicker also. For the top level test directory, I think we just need to create a modified test/run.go for llgo and the question then would be where to put it. IMO it shouldn't be in cmd as "regular users" not developing llgo are unlikely to want to run it, but it might be a good idea to turn it into a xxx_test.go file which could then be tested by the drone.io builder. What do you think? I'll start working adapting it for llgo. |
I think that sounds great; perhaps a test in llgo/llgo. Agreed on it not going into cmd.
Thanks! |
Some of the tests use packages not currently built by llgo-dist, one of them being I'm getting:
so if the directive is indeed implemented it needs to add a _ prefix on darwin. |
"#llgo" directives (attributes) are defined in attribute.go I'm not so sure this is the same "_" issue as in the C files, because the attribute is setting an IR name, not a symbol name. Having said that, I don't know what the issue is there. |
Using llvm-dis on the generated bytes.bc, seems there's a number appended at the end |
This appears to be expected behavior:
Moot point after #42 is implemented I guess. |
I don't think so; this is sane behaviour, and would be carried over to any pure-Go IR writer. The real problem here is that there are two declarations of IndexByte and Equal, and there shouldn't be. This is because pkg/bytes/bytes_decl.go is declaring the functions, and then they're redeclared in bytes_libc.go. Somehow, what needs to happen, is for the declaration from bytes_decl.go to be dropped, and the bytes_libc.go to take its place. |
Ah. Good point :) |
Regarding a "llgo-test", I think it's better to just have a "-test" flag in llgo-build as there's much overlap for these two activities. I'm looking into this now. |
I would be happy with that. BTW, thanks for filing all of the issues. I haven't had much time to look at them in detail yet. If you plan to look into some, please add a comment or assign yourself so I know not to duplicate effort. |
Will do. This issue depends on getting #43 working first as, which I just found out, otherwise |
For the curr := fn.GlobalParent().NamedFunction(name)
if !curr.IsNil() {
curr.SetName(name + "_llgo_replaced")
curr.ReplaceAllUsesWith(fn)
}
fn.SetName(name) in |
Nice. I think that's fine in nameAttribute, however I'd like to see a check that the function it's replacing has no body. Does that sound sensible to you? |
Yup |
This is able to create a binary for some packages, although I'm having issues actually running them. Will comment in go-llvm#48 with more details. This PR depends on having merged the others first.
So with #90 I'm getting this far:
Any suggestion on what might be amiss? Other packages segfault:
Many other packages will not build due to unresolved externals, presumably due to non-translated assembly code. |
cmd/llgo-build: Add -test flag creating a test binary. For #48.
I consider this one done, lets open up separate issues for individual test failures or other improvements that should be made to either |
Just a place to discuss this so that I can easier find it in the future.
The text was updated successfully, but these errors were encountered: