[tbb-bugs] #28716 [Applications/Tor Browser]: Create a mingw-w64-clang project

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Feb 7 10:19:04 UTC 2019

#28716: Create a mingw-w64-clang project
 Reporter:  gk                                   |          Owner:  tbb-
                                                 |  team
     Type:  task                                 |         Status:
                                                 |  needs_review
 Priority:  High                                 |      Milestone:
Component:  Applications/Tor Browser             |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tbb-rbm, TorBrowserTeam201902R,      |  Actual Points:
  GeorgKoppen201902                              |
Parent ID:  #28238                               |         Points:
 Reviewer:                                       |        Sponsor:

Comment (by cypherpunks33):

 Some notes:
 > Bug 28716: Add a mingw-w64-clang toolchain
 > This commit adds a mingw-w64/clang toolchain
 Dash or slash problem. Also this is actually a mingw-w64-llvm toolchain,
 which looks weird, as it means GNU ABI target that is incompatible with
 now system/standard/default/universal C runtime. Currently LLVM has almost
 all we need to make a FOSS toolchain that can have a true Windows target,
 i.e. MS ABI. Once we can make everything we need Windows-compatible, we
 should drop MinGW-w64 in the target triple and rename the toolchain to its
 canonical name 'LLVM toolchain' (llvm-project).

 > 2) We don't build clang in 3 stages but just one like we do for our
 macOS cross-compilation toolchain.
 Hrm, Mozilla also doesn't build clang in 3 stages for their macOS cross-
 compilation toolchain. Maybe, because, as official GCC docs say "When
 building a cross compiler, it is not generally possible to do a 3-stage
 bootstrap of the compiler." But if you are excited in building
 bootstrapped cross-compilers, let me propose the following:
  A way to build a bootstrapped cross-compilation toolchain.
 1. "To build a cross compiler, we recommend first building and installing
 a native compiler. You can then use the native GCC compiler to build the
 cross compiler."

  But the proposal is to bootstrap the whole LLVM native toolchain on Linux
 (which will also be useful for doing LLVM builds of TBB for Linux).
 (stage1 of bootstrap)
 2. Build LLVM cross-compilation toolchain by toolchain from step 1.
 3. Build LLVM cross-compilation toolchain in Wine by toolchain from step
 2. (yes, cross-compiling from Windows to Linux)
 4. Build LLVM cross-compilation toolchain by toolchain from step 3.
 This allows us to "Perform a comparison test of the stage2 and stage3
 compilers." And, even more, if our LLVM toolchains are reproducible, we
 should get bit-to-bit identical packages of stage2 and stage3 LLVM cross-
 compilation toolchains!
 What do you think?
 > 3) We don't build libcxx* and compiler-rt for the host system like
 build-clang.py is doing.
 We can do even more as part 1 of the above proposal.
 > 4) We are omitting the `DEBUG_FLAGS` (-g -gcodeview) as we plan to
 actually ship the resulting build to users, which seems okay (see bug
 Could you also move the code block with `-g -gcodeview` in esr60 to
 `--enable-debug` section, so that we can get the fix included in TBB 8.5?
 > 5) We don't add a symlink to `llvm-nm` as it doesn't seem to be needed.
 But we should do it as part of the current GCC 'drop-in replacement'
 strategy. Also it is officially recommended to do this for all LLVM tools
 at once (with recommended symlinks: `gcc` to `clang`, `g++` to `clang++`
 and `ld` to `lld`).

Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28716#comment:44>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online

More information about the tbb-bugs mailing list