Skip to content
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

"gold" linker should be replaced with another linker #4521

Open
stefantalpalaru opened this issue Jul 16, 2024 · 4 comments
Open

"gold" linker should be replaced with another linker #4521

stefantalpalaru opened this issue Jul 16, 2024 · 4 comments

Comments

@stefantalpalaru
Copy link
Contributor

The "gold" linker is being used on Linux, but Gentoo devs dropped support for it, after declaring it dead upstream: https://bugs.gentoo.org/936112

Replacing it with an external "lld" is as easy as:

diff '--color=auto' -ur pony-0.58.5.orig/src/libponyc/codegen/genexe.c pony-0.58.5/src/libponyc/codegen/genexe.c
--- pony-0.58.5.orig/src/libponyc/codegen/genexe.c	2024-07-15 22:32:04.539142266 +0200
+++ pony-0.58.5/src/libponyc/codegen/genexe.c	2024-07-15 22:35:08.622074939 +0200
@@ -349,7 +349,7 @@
   const char* mcx16_arg = (target_is_lp64(c->opt->triple)
     && target_is_x86(c->opt->triple)) ? "-mcx16" : "";
   const char* fuseldcmd = c->opt->link_ldcmd != NULL ? c->opt->link_ldcmd :
-    (target_is_linux(c->opt->triple) ? "gold" : "");
+    (target_is_linux(c->opt->triple) ? "lld" : "");
   const char* fuseld = strlen(fuseldcmd) ? "-fuse-ld=" : "";
   const char* ldl = target_is_linux(c->opt->triple) ? "-ldl" : "";
   const char* atomic =

This issue has been separated from the similarly named #1837

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Jul 16, 2024
@jemc jemc changed the title "gold" linker should be replaced with "lld" "gold" linker should be replaced with another linker Jul 23, 2024
@jemc
Copy link
Member

jemc commented Jul 23, 2024

I updated the title to be more general - to satisfy this ticket we just need to replace it with any working linker - not necessarily LLD.

Though the embedded LLD mentioned in the other ticket would be a nice touch - it would be a lot more work than the simple change you have above.

Whatever linker we select should be a widely available one, since we'd need to expect ponyc users to have it on their machines, as a dependency (unless we use an embedded LLD to completely remove the external dependency).

@jemc jemc removed the discuss during sync Should be discussed during an upcoming sync label Jul 23, 2024
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Jul 23, 2024
@burjui
Copy link

burjui commented Aug 6, 2024

Support for mold would be nice. I am using it with Rust, and it cuts compile times qiute significantly.

@SeanTAllen
Copy link
Member

@burjui if mold is a drop in replacement for gold then you should be able to use it now on any platform where we are using gold.

@jemc jemc removed the discuss during sync Should be discussed during an upcoming sync label Aug 6, 2024
@jemc
Copy link
Member

jemc commented Aug 6, 2024

Discussed in the sync call today.

It's unclear how "dead" gold actually is, and it's still present on all the Linux distros we currently build for. Unless/until it starts to get dropped by other distros we build for, this probably won't be a priority. Whatever default it gets replaced with would need to be something that is present on all the distros that we need.

Note that if you're running on a system where gold is not present, you can override the linker command with the CLI option --link-ldcmd. See the help string for ponyc for other CLI options.

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Aug 6, 2024
@jemc jemc removed the discuss during sync Should be discussed during an upcoming sync label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants