Hi David, > libgccjit fails to link on OS X and Solaris due to jit/Make-lang.in, > due to the assumption there that the linker is GNU ld. Specifically, > jit/Make-lang.in hardcodes the use of two options: --version-script > and -soname. > > * on Darwin, --version-script doesn't seem to exist in the linker, and > it uses -install_name rather than -soname. > > * on Solaris, ld doesn't support --version-script. However, the version > script used for libgccjit.so doesn't use any gld extensions, so one can > just use -M instead. > > This patch fixes these issues by using variables emitted by gcc's "configure" > rather than hardcoding the options in jit/Make-lang.in. > > It's based on the first part of Rainer's patch for PR jit/84288, but I > made the following changes: > * the GNU ld case in configure.ac wasn't setting ld_version_script_option. > I set it to "--version-script" for that case.
That's weird: the configure.ac part starts with ld_version_script_option='--version-script' only overriding it in the Solaris case to keep things for other hosts as they were. Besides, I'm pretty sure I tested the patch on Solaris with gas/gld to make certain that combo continues to work as is... > * I moved the: > LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@ > from gcc/jit/Make-lang.in to gcc/Makefile.in, as the Make-lang.in files > aren't substituted, only the gcc/Makefile.in. > Rainer: how did this work for you? It didn't: what I'd attached to the PR was an initial version of the patch in the middle between manually hacking gcc/jit/Make-lang.in and properly autoconfiguring things. > * added LD_SONAME_OPTION, done in the same way > * conditionalized the usage of the options in Make-lang.in to cope with > empty LD_VERSION_SCRIPT_OPTION (as is presumably the case on OS X). > I used ($if condition,then-part[,else-part]) for this. > I had to add a $(COMMA) since the "then-part" contains commas, which > need to be treated as part of the "then-part", rather than separators > for the "else-part". > Hopefully this is compatible with every "make" implementation that we > support. > > Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. > > I lightly tested the not-recognized case by hacking up the configure.ac > (on x86_64-pc-linux-gnu) and verifying that it links, and that a > smoketest of jit.dg/test-factorial works. > > Does this fix the jit linker issues on OS X and Solaris? I'll give it a whirl tomorrow, including the jit-recording.c part of my patch to allow the build to complete. Thanks. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University