-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linker warnings when building Rust examples #19
Comments
Can you dump the contents of Not sure what I'm looking for, but seems like a good place to start ... |
Oh, and the most obvious thing is that if you can install a "normal" rustc which produces host binaries and check if that works. And if it works, can you compile the same version as the package uses and test that too? If that works too, then we just need to narrow down the differences. |
Compiling with the rustc built by rumpkernel-packages without I added the output of readelf -x and readelf -w here: https://gist.github.com/skade/6e2c7138725ffe20538c |
Ah, I didn't realize you could run the existing one without Hmm. Then I guess we should know which stage the error is coming from. Can you edit a |
Yes. The built Rust compiler generates binaries for the host by default, i.e. if you don't specify |
|
Ah, ok, so linking the relocatable succeeds. Next up:
Then run the |
and by rumpbake I mean |
sigh. |
See the output here: https://gist.github.com/skade/6e2c7138725ffe20538c#file-readelf-with-succeed rumpbake gives:
|
No, set |
Heh, it actually ran under
The output file is rather large, is it still necessary after this? |
Visual effect: best when portraying the truth ;-) and the hexdump (-x) for .eh_frame? |
Also, can you set
Then send the output of |
The "debug" item in the gist is still missing Also, it looks like the linker script is different from what I have with a newer Ubuntu or even from what I could find from the GNU binutils repository for 2.24. Is it possible for you to try with binutils 2.25? I wouldn't be too surprised if there was something subtly broken in 2.24 than only our setup manages to tickle. (which is not to say I'm 100% sure it's not our bug, just that it's a reasonable thing to test) |
I wouldn't be too surprised if this diff (which is in binutils 2.25) fixes it: The gist is still missing Now, if I'm allowed to get ahead of myself (knock knock), if the linker is the problem, I don't think there's much we'll do except say "use a newer linker for rust and its exceptions". Using a relocatable object (i.e. one produced by Well, yea, the above paragraph of course depends on 2.25 actually fixing the linking, so I dearly hope I didn't jinx it ;-) |
With ld 2.25:
It still gives a warning on bake:
|
Do you mean hello gives a warning, or only hello-tcp? Also, the message you pasted says "error". Does hello-tcp actually work? What's your g++ version? |
Both work. The error is only seen when using rumpbake directly. g++ is:
|
What do you mean "directly on the binary"? You have to bake before you can run and therefore observe a working result, so I'm quite confused now. |
Sorry, wrote too much, corrected. The second example uses |
So let's summarize:
Did I get that right? |
Yes. |
On Friday, 09.10.2015 at 05:04, Antti Kantee wrote:
I've just built the rust examples on my Xen box running Debian stable, GCC @anttikantee: Regarding ld -r as an intermediate format, incremental |
Nuts. Anyway, just as a data point, I don't locally get the c'est-ne-pas-error you're seeing. |
On 09/10/15 12:26, Martin Lucina wrote:
From the binutils thread linked above: === snip === If the binutils attitude is that, I wouldn't be too surprised if we'd |
Another data point: If I perform a full manual link of hello with no
|
It'd be useful to have some way of verifying the exception handling in Rust actually works. Not knowing anything about rust, could someone knowledgeable write a simple test program that actuall uses exceptions? |
Rust has no exceptions. It only has stack unwinding on panic. Panics cannot be recovered.
/cc @steveklabnik might know someone with deeper knowledge or have it. |
The above program produces:
The faulting address is |
My understanding is that panics end up with basically the same implementation as exceptions have, we just don't have the catching mechanism. This is slightly above my pay grade, but a page fault to me would indicate that you're not generating landing pads/guard pages? Maybe? I need more coffee. |
It looks like our EH is seriously broken (not surprising, since I don't think anyone's actually tested it). I've opened an issue (rumpkernel/rumprun#55) with a simple C++ test program. The ld |
If rust uses exceptions only for panics, we can say that we fully support bug-free rust programs ;-) |
Can the synopsis be changed to something less dramatic, e.g. "error" -> "warning"? |
Hi all, just a data point here, for OSX, I followed the tutorial to build the ELF cross compiler, and the ld version it generates is 2.23.2. |
@Gael if you could confirm that that works, you'd save my weekend :D |
Bad news, it does not work. Compilation fails for bfd, bfd.info and other stuff. There may be additional steps like patching, but I don't know how it works on this platform. |
Apparently, the NetBSD-current sources only have ld 2.23. |
I'd download binutils (and gcc) and build them manually, IIRC it's pretty much just configure+make. The advantage of the build.sh method was really only that you need so few commands, but if you need to start manually downloading and patching things too, that advantage is already lost. |
polyfractal in IRC mentioned that you may have pointers where to fix this in rumprun itself, sadly, I lost it :(. |
I built binutils manually with |
It's mentioned already above: getting rid of a relocatable object as the intermediate format between cc and rumprun-bake. As long as the folks writing the linker think using a relocatable object is misguided (see quote above), don't think we'll have an easy life down that path. The obvious first step for doing it correct would be to ask the binutils folks what they'd suggest instead. The quickest way to hack it, as far as I can imagine, is to record the params to "cc -o" in the link phase, place them into the "object", and just replay the entire command line along with the libs specified by rumprun-bake. If done that way, we lose the ability to copy the "object" around, but if that's a price we have to pay for things working, then so be it (at least for now). Bundling things up into a custom, copyable format (e.g. tarball) is probably going to be difficult and require full understanding of ld parameters -- for example, you can read an object, but can't necessarily write to that path, so you need to mangle all the parameters. |
Alright, if I build binutils 2.25 and GCC 5.1 manually on OSX, then rumprun, I get a working toolchain (no need to rebuild rustc and cargo). I updated the wiki page with the instructions. |
On 26/11/15 13:43, Geoffroy Couprie wrote:
Thanks for figuring out how to do that, and even more so for documenting it. Can you coordinate with @mattgray to re-polish the page? I think we |
The implications are: imagine an emacs vs. vim debate, but about package managers. |
I have the following build error for the Rust examples:
(Full output here: https://gist.github.com/skade/6e2c7138725ffe20538c)
The system is a stock Ubuntu 14.04 LTS. I have built rumprun with
CC=gcc-4.8
andCC=gcc-4.9
, but with no success.I can provide a VMWare VM (Vagrant) on request or try to rebuild the whole stack on Virtualbox if necessary.
The text was updated successfully, but these errors were encountered: