Bug 240918 - devel/llvm90: default to -march=i586 to avoid libatomic on i386
Summary: devel/llvm90: default to -march=i586 to avoid libatomic on i386
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
Keywords: patch, patch-ready
Depends on:
Reported: 2019-09-29 13:29 UTC by Jan Beich
Modified: 2019-10-10 00:45 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)
jbeich: merge-quarterly?

v1 (5.52 KB, patch)
2019-09-29 13:29 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2019-09-29 13:29:16 UTC
Created attachment 207933 [details]

Apply base r352030 to help Firefox-based ports with the following:

mozglue/misc/TimeStamp.o: In function `mozilla::TimeStamp::NowFuzzy(mozilla::TimeStamp63Bit)':
TimeStamp.cpp:(.text._ZN7mozilla9TimeStamp8NowFuzzyENS_14TimeStamp63BitE+0x22): undefined reference to `__atomic_load_8'
mozglue/misc/TimeStamp.o: In function `mozilla::TimeStamp::UpdateFuzzyTimeStamp(mozilla::TimeStamp)':
TimeStamp.cpp:(.text._ZN7mozilla9TimeStamp20UpdateFuzzyTimeStampES0_+0x28): undefined reference to `__atomic_store_8'
mozglue/misc/TimeStamp.o: In function `mozilla::TimeStamp::NowFuzzyTime()':
TimeStamp.cpp:(.text._ZN7mozilla9TimeStamp12NowFuzzyTimeEv+0x1a): undefined reference to `__atomic_load_8'
mozglue/misc/TimeStamp.o: In function `mozilla::TimeStamp::UpdateFuzzyTime(long long)':
TimeStamp.cpp:(.text._ZN7mozilla9TimeStamp15UpdateFuzzyTimeEx+0x20): undefined reference to `__atomic_store_8'
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

Builds fine:
- llvm90 on 11.2/11.3/12.0/13.0 amd64/i386
- thunderbird, firefox, firefox-esr, cliqz on 11.2 i386
Comment 1 Jan Beich freebsd_committer 2019-10-04 18:45:13 UTC
(In reply to Jan Beich from comment #0)
> - thunderbird, firefox, firefox-esr, cliqz on 11.2 i386

Upstream of these doesn't support anything below -march=pentium4 but downstream lowered to -march=i686, see lang/rust/files/patch-src_librustc__target_spec_i686__unknown__freebsd.rs and https://bugzilla.mozilla.org/show_bug.cgi?id=1300843

Ignoring Gecko only 9 ports override CC/CXX to use devel/llvm90:
- comms/gnuradio (skipped due to BROKEN in comms/uhd)
- graphics/pcl-pointclouds (BROKEN, related to libatomic)
- graphics/qgis-ltr
- math/casadi
- misc/veles
- net/aluminum
- science/agrum
- science/erkale (BROKEN, related to libatomic)
- security/afl++
Comment 2 Jan Beich freebsd_committer 2019-10-08 01:46:29 UTC
I do intend to land this at the end of the week per maintainer timeout. Other than LLVM_DEFAULT some users also build everything with a compiler from ports (usually, on old releases).

Let the best not be the enemy of the good.
Comment 3 Brooks Davis freebsd_committer 2019-10-08 17:13:52 UTC
Please let me land this.  I'll aim to do it by the end of the week.  I'd like to roll it up with other changes to reduce the number of times people have to rebuild llvm.
Comment 4 Jan Beich freebsd_committer 2019-10-09 06:02:29 UTC
Would "roll it up with other changes" prevent MFH to 2019Q4? Other than the future 9.0.1 almost everything will have low risk to go under ports-secteam blanket (reliability/regression fixes).
Comment 5 Brooks Davis freebsd_committer 2019-10-09 17:22:15 UTC
(In reply to Jan Beich from comment #4)
This would be merging fixes to crashes so the sort of thing that should be MFH.
Comment 6 commit-hook freebsd_committer 2019-10-09 20:36:11 UTC
A commit references this bug:

Author: brooks
Date: Wed Oct  9 20:36:06 UTC 2019
New revision: 514194
URL: https://svnweb.freebsd.org/changeset/ports/514194

  Rollup of fixes since the 9.0.0 release.

  - Change the default -march for i386 from i486 to i586.  This avoids
    the need for libatomics and had been the defacto default for some
    time. [0]

  - Add -m(no)-spe to clang. (powerpc)

  - Deduce MIPS specific ELF header flags from `emulation`. (mips)

  - Fix a variety of assertions and compile/link errors including crashes
    with CPUTYPE=haswell. [1]

  - Switch back to https for downloads. [2]

  The new patches were initially committed to FreeBSD src by dim@.

  PR:		240918 [0], 240759 [1], 240870 [2]
  Reported by:	jbeich [0,1],  Miyashita Touka <imagin8r@protonmail.com> [2]

Comment 7 commit-hook freebsd_committer 2019-10-10 00:45:43 UTC
A commit references this bug:

Author: jbeich
Date: Thu Oct 10 00:44:58 UTC 2019
New revision: 514199
URL: https://svnweb.freebsd.org/changeset/ports/514199

  gecko: drop LLVM_DEFAULT workaround for i386 after r514194

  PR:		240918