ponyc icon indicating copy to clipboard operation
ponyc copied to clipboard

Use embedded LLD for linking

Open sylvanc opened this issue 8 years ago • 14 comments
trafficstars

https://lld.llvm.org

This would eliminate the compiler's dependence on a C compiler for linking on Linux and on link.exe for linking on Windows.

LLD could be used as a library rather than needing to shell out to it.

sylvanc avatar Apr 12 '17 20:04 sylvanc

LLD is still buggy on Mac: https://bugs.llvm.org/show_bug.cgi?id=32376

malthe avatar May 22 '17 09:05 malthe

Hey guys,

slowly but surely returning to this project: I have implemented this and just need to test it on Windows. This issue can be assigned to me and I make sure to submit a pull request soon.

Looks good on OSX, Linux and BSD!

sblessing avatar Apr 30 '18 13:04 sblessing

Hey @sblessing! Welcome back.

I've sent you an invite to the org so you can be assigned this ticket. Once you accept, write back here and I'll assign you.

jemc avatar Apr 30 '18 21:04 jemc

Hello,

due to ld.gold being rather buggy on musl (it just plain crashes if built without -fPIE: ld.gold: fatal error: build/release/stable: No error information) Alpine would be very interested in this too (or maybe I can somehow work around this for now by doing position executable binaries with ponyc? I don't know ponyc too well, sorry for my little knowledge :)

Cogitri avatar Jun 07 '19 21:06 Cogitri

Yes, PIE is support already @Cogitri. If you pass default_pic=true to make when building Pony, it will use when linking all binaries. See https://www.ponylang.io/faq/#pic-compile-error

SeanTAllen avatar Jun 07 '19 21:06 SeanTAllen

Hm, I already build ponyc with that option and just tried with ponyc --pic and it resulted in the same build error for pony-stable. Adding CFLAGS=-fPIE did the trick for ponyc, but I guess this leaves us with a non-functional compiler nontheless :/

Cogitri avatar Jun 07 '19 21:06 Cogitri

We build and release for alpine all the time, so I'm not sure what issue you are running into. I suggest checking https://github.com/ponylang/ponyc/blob/master/.dockerhub/alpine/Dockerfile. Beyond that, please open a new issue as this is off topic for this issue.

SeanTAllen avatar Jun 07 '19 21:06 SeanTAllen

Ah, sorry, I felt this was related to this due to using LLD as linker would fix this. I'll open a new issue.

Cogitri avatar Jun 07 '19 21:06 Cogitri

No need to apologize @Cogitri. We have veered off from LLD though.

SeanTAllen avatar Jun 07 '19 21:06 SeanTAllen

I do have a running implementation with LLD. Unfortunately LLD is not yet where we need it to be and, and using LLD wouldn't remove vcvars.* :(

But I do think that LLD 9.0.0 looks promising.

sblessing avatar Jun 14 '19 07:06 sblessing

@sblessing any update on LLD 9.0.0?

SeanTAllen avatar Dec 13 '19 19:12 SeanTAllen

@SeanTAllen Yes. I do have various examples running and so far it looks good. Do we need an RFC to eventually get this merged (and potentially at first have this as an experimental ponyc option)

sblessing avatar Mar 03 '20 08:03 sblessing

I think an RFC would make sense to clarify how/if to expose it to users of ponyc (as an experimental flag or just replace using the system linker). I know I tend to avoid the RFC-route, but in this case I would be fine to bring it in without RFC if it is only enabled via experimental option flag.

mfelsche avatar Mar 03 '20 10:03 mfelsche

I'm looking to get this moving. See more in Zulip:

https://ponylang.zulipchat.com/#narrow/stream/189952-compiler-discussion/topic/Embedding.20lld.20in.20ponyc

SeanTAllen avatar Jan 22 '22 22:01 SeanTAllen

I saw this in 2020, and it was the one issue that kept me from Pony. I eventually learned and now develop in Go, mainly because the install process is simple, for Linux macos and windows. I would still like to try Pony, but asking windows users to install an extra 1 gb worth of stuff (visual c), is hard to justify when the current Go installer is 70 mb, linker included.

3052 avatar Dec 20 '23 05:12 3052