https://bugzilla.redhat.com/show_bug.cgi?id=2449216



--- Comment #30 from [email protected] ---
(In reply to Fabio Valentini from comment #26)
> (In reply to cyphar from comment #21)
> > (In reply to Brad Smith from comment #19)
> > >
> > > Is using clang a hard requirement?
> > 
> > So, lld is a hard requirement for all architectures -- GNU ld doesn't like
> > the hacks you need to do to get symbol versioning working with Rust, so lld
> > is a requirement.
> > On *some* architectures (aarch64, if memory serves) rustc will pass special
> > linker flags based on what -linker= flag you have configured (to work around
> > some arch-specific issues on a per-linker basis), and in my experience that
> > meant you needed to use clang (-fuse-ld=lld isn't enough to stop rustc from
> > passing bad flags to lld). It is possible that the newest Rust versions
> > (>=1.90, which default to lld) don't need these workarounds but most of my
> > packaging / testing work was dealing with old Rust versions.
> 
> So, I'm not sure whether this will work.
> 
> Rust >= 1.90 only defaults to lld upstream, and only for
> x86_64-unknown-linux targets AIUI - and as far as I know, this change hasn't
> made it to Fedora - we still use GNU ld by default everywhere. We also need
> to pass some special linker flags / scripts that I'm not sure lld supports
> (but it might?).

Hmmm. Well, if you only build the static version then you can avoid the problem
and use GNU ld (build.rs handles this already), but I'm guessing the Fedora
packaging guidelines disallow that?

I wanted to get it to work with GNU ld but after fighting with it for weeks I
ended up just going with what seems like the only working option.

The core issue is that Rust doesn't support symbol versioning or custom version
scripts properly[1], so you need to pass a custom version script to the linker
but because Rust provides its own version script to hide internal symbols and
GNU ld does not support setting the --version-script flag more than once --
meaning you just get linker errors with GNU ld. I had an awfully hacky setup
where I created a tmpfs bindir with ld and collect2 wrapper bash scripts that
messed with the arguments to make them work with GNU ld, and while that did
compile it ended up producing useless symbols that I just couldn't get working
-- and I'm sure that kind of awful hack would also not be looked upon
favourably in Fedora packaging either. :/

[1]:
https://internals.rust-lang.org/t/support-symbol-versioning-with-export-name/23626


-- 
You are receiving this mail because:
You are always notified about changes to this product and component
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2449216

Report this comment as SPAM: 
https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202449216%23c30

-- 
_______________________________________________
package-review mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://forge.fedoraproject.org/infra/tickets/issues/new

Reply via email to