ARM build with LLD linker (LLVM linker) fails with: "ld.lld: error: undefined symbol: main"
gem5 fc9b1b5089a5d8233f70ed6452af4a6bf7ccb326, Ubuntu 20.10, LLD 11.0.0, GCC 10.2.0:
Was working on earlier gem5 ccee3283341454c4480eadd568b010857a044d1a and works without LDFLAGS_EXTRA=-fuse-ld=lld.
--verbose logs at: https://gist.github.com/cirosantilli2/fe9a6da6bf730adbea11cb23fa4ebbbb I didn’t dig into them yet.
Ah, OK, good to know about the parallelization thing.
Nothing on the pybind11 front unfortunately. I was the last to comment on the pull request: https://github.com/pybind/pybind11/pull/2445 in January, and they were once again supportive to merging after some other patches went in, but I’m still waiting for their greenlight (it should be faster to re-split on master rather than rebase I believe now). I think they’re just a bit short on manpower to review patches. It might help if another person from gem5 pings them to make it clearer that this is important to the project as a whole, not just me. I would recommend a happy Easter message, this Sunday.
No problem. You might want to try with LTO with gold or regular ld since with the LTO plugin it apparently makes that part of the link parallel. It can make a big difference depending on how many cores you have.
BTW, and a bit of a tangent, has anything happened with the pybind folks? Last I heard you were waiting for them to check in your fix?
Thanks for looking into this Gabe. For context, the reason I ended up using LLD is that it links way faster than traditional ld (due to parallel link) and also a bit faster than gold, and because I found that gold (which I added a dedicated option for earlier) breaks debugging symbols some times, making LLD the best development option I’ve found so far. Shame it doesn’t do LTO well currently then. Saw some discussion at: now.
Yes. After bisecting this, it’s because LTO is turned on for opt now, and when I was playing around with linkers to see what build/run time performance we could get, I noticed that lld doesn’t play nice with LTO for a reason I never tried to figure out.
If you side channel force the build to use lld, then you also need to disable LTO and it should work. It would be nice to know why lld doesn’t play nice, although since it isn’t an officially wired in configuration I wouldn’t consider it critical.
: Any idea with this?