Commit Graph

309 Commits

Author SHA1 Message Date
Mike Hommey
4e8e23f4e8 Bug 1729383 - Simplify the parallel build setup. r=firefox-build-system-reviewers,mhentges
Historically, client.mk was not invoked with -jn because it would create
race conditions, but that was actually mostly solved by the addition of
`.NOTPARALLEL` in bug 422986, although the mechanism of adding -jn via
`MOZ_MAKE_FLAGS` or `MOZ_PARALLEL_BUILD` has continued well past that.

Nowadays, client.mk is only invoked by mach (it will even bail out if
that's not the case) and only has one target (`build`) and no
dependencies.

This means we don't need to rely on `MOZ_PARALLEL_BUILD` to pass `-jn` in
some cases, and can just always invoke `make -f client.mk` with `-jn`, even
when we just want no parallelism, in which case we can use `-j1`.

This, in turn, allows to remove the extra allow_parallel argument to
`_run_make`, and only rely on `num_jobs`, and to remove some of the
multiple ways the `n` in `-jn` could be set.

Differential Revision: https://phabricator.services.mozilla.com/D124729
2021-09-08 00:10:22 +00:00
Dzmitry Malyshau
c196398803 Bug 1726628 - Switch cargo resolver to 2 r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D123157
2021-09-01 21:11:33 +00:00
Mike Hommey
c39f6708e7 Bug 1724391 - Reset PKG_CONFIG_PATH. r=firefox-build-system-reviewers,mhentges
If it has a value set, that interferes with values we set to other
PKG_CONFIG_* variables for sysroots.

Differential Revision: https://phabricator.services.mozilla.com/D122287
2021-08-11 22:03:14 +00:00
Mike Hommey
023ce9967d Bug 1582382 - Move rust malloc and oom hook to mozglue. r=firefox-build-system-reviewers,andi
This is similar to what was done in bug 1594998 for the panic hook.

Differential Revision: https://phabricator.services.mozilla.com/D121032
2021-07-28 20:33:08 +00:00
Mike Hommey
2979d0b082 Bug 1635327 - Disable __tls_get_addr interception in sanitizer builds. r=firefox-build-system-reviewers,emilio,andi
Sanitizers try to intercept __tls_get_addr to find DTLS blocks. In some
cases, they fail miserably with a crash. And in the cases they don't
crash, they don't seem to actually work properly anyways.

This affects both build time when running host programs compiled with
sanitizer flags (this only actually affects rust build
scripts/procedural macros on non-cross builds, not C/C++ host programs),
and execution time, e.g. when running tests.

Differential Revision: https://phabricator.services.mozilla.com/D120574
2021-07-22 22:00:59 +00:00
Henri Sivonen
b5366f5a31 Bug 1716709 - Remove RUSTC_BOOTSTRAP for xmldecl. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D117980
2021-06-17 06:44:25 +00:00
Mike Hommey
7f9a51a8f5 Bug 1715282 - Bump minimum Rust version to 1.51. r=firefox-build-system-reviewers,andi
Also update the estimated rust versions for future releases, based on
the updated Firefox release dates.

Differential Revision: https://phabricator.services.mozilla.com/D117737
2021-06-15 09:23:20 +00:00
Mike Hommey
d85b55ac8e Bug 1712947 - Don't pass neon flags to rustc when using thumbv7neon targets. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D116067
2021-05-27 21:36:34 +00:00
Mike Hommey
d9c58f174d Bug 1707829 - Go back to building http3server as a rust program. r=necko-reviewers,kershaw
This mostly revert bug 1616238.

Differential Revision: https://phabricator.services.mozilla.com/D113485
2021-05-07 20:22:56 +00:00
Mike Hommey
42db02783f Bug 1709994 - More consistently set MOZ_CARGO_WRAP_LDFLAGS. r=firefox-build-system-reviewers,mhentges
- We can and actually should remove the -fsanitize=% flags consistently
  on all cargo targets, not only programs, but because of limitations in
  cargo we can't really do that everywhere. We do need it for TSAN,
  though.
- Because of the above, we actually don't need to single-out NATIVE_TSAN
  builds anymore.
- The comment regarding the initial filtering of MOZ_CARGO_WRAP_LDFLAGS
  somehow got separated from where it's happening, so we move it back to
  where it belongs.

Differential Revision: https://phabricator.services.mozilla.com/D114579
2021-05-07 20:22:55 +00:00
Sandor Molnar
93e6afe93a Backed out changeset bd2c9d3fa4b0 (bug 1707829) for causing xpc failures. CLOSED TREE 2021-05-07 01:58:43 +03:00
Mike Hommey
eae232636b Bug 1707829 - Go back to building http3server as a rust program. r=necko-reviewers,kershaw
This mostly revert bug 1616238.

Differential Revision: https://phabricator.services.mozilla.com/D113485
2021-05-06 21:37:01 +00:00
Mike Hommey
506594be8f Bug 1709253 - Fix building rust programs. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D114212
2021-05-04 20:45:43 +00:00
Andi-Bogdan Postelnicu
a63d3f564b Bug 1697215 - Disable value profiling in Rust PGO until we move to to rust 1.52. r=firefox-build-system-reviewers,glandium
Credit goes to dmajor.
Rust gets LLVM 12 - https://github.com/rust-lang/rust/pull/81451.
The PGO format changed between 11 and 12, and builds will have poor optimization if we mix versions in xLTO.
The above PR has landed on Rust nightly 1.52.
Until we move to 1.52 nightly we should have this landed.

In the meantime, for unblocking try builds, we can disable value-PGO in Rust.

Differential Revision: https://phabricator.services.mozilla.com/D113327
2021-04-28 09:56:12 +00:00
Mike Hommey
58fac4ff62 Bug 1704580 - Set rust optimization level via CARGO_PROFILE_*_OPT_LEVEL. r=firefox-build-system-reviewers,mhentges
Setting it via -C opt-level makes us hit
https://github.com/rust-lang/cargo/issues/9358 so use an alternative
way, that works since rust version 1.43.0.

Differential Revision: https://phabricator.services.mozilla.com/D112158
2021-04-20 00:33:59 +00:00
Henri Sivonen
b98488aa92 Bug 673087 - Honor encoding declared via XML declaration in text/html. r=emk
Differential Revision: https://phabricator.services.mozilla.com/D107806
2021-03-23 09:52:04 +00:00
Jesse Schwartzentruber
0026d74b59 Bug 1695285 - Pass ASan/UBSan flags to cargo for native builds. r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D106652
2021-03-18 20:46:55 +00:00
Christian Holler
4cf2f28556 Bug 1689597 - Add Fuzzilli support to the build system. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D103467
2021-03-11 12:13:21 +00:00
Alexandru Michis
e18957315d Backed out changeset 9bada5ab20d7 (bug 1695285) for causing Linux asan bustages.
CLOSED TREE
2021-03-10 07:55:32 +02:00
Jesse Schwartzentruber
32d19f30ad Bug 1695285 - Pass ASan/UBSan flags to cargo for native builds. r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D106652
2021-03-10 00:05:28 +00:00
Mike Hommey
7eb38cd807 Bug 1670538 - Use an allow-list in RUSTC_BOOTSTRAP for rustc >= 1.50.0. r=firefox-build-system-reviewers,andi,sheehan,mhentges
While we could change qcms, encoding_rs and packed_simd to not emit
RUSTC_BOOTSTRAP on newer versions of rust, like we do for gkrust-shared,
it's not worth the effort (especially for those that are vendored).

Differential Revision: https://phabricator.services.mozilla.com/D105423
2021-02-17 21:47:28 +00:00
Mike Hommey
5f86b697af Bug 1692137 - Allow local linux builds to use a bootstrapped sysroot. r=firefox-build-system-reviewers,andi,mhentges
Bug 1690930 added sysroots that can be bootstrapped. With this change,
we allow --enable-bootstrap=install to pull the right sysroot for the
configured target, and --enable-bootstrap to update it if it was already
there.

Differential Revision: https://phabricator.services.mozilla.com/D104797
2021-02-12 20:31:49 +00:00
Mike Hommey
f40865b13e Bug 1632776 - Work around autocfg tests failing on Windows PGO builds. r=firefox-build-system-reviewers,sheehan,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D103276
2021-01-28 16:47:38 +00:00
Masatoshi Kimura
03d7defdfa Bug 1684110 - Define UNICODE on some directories. r=glandium
so that people do not accidentally use 'A'-functions.

Differential Revision: https://phabricator.services.mozilla.com/D100420
2021-01-13 22:49:59 +00:00
Emilio Cobos Álvarez
04229a0075 Bug 1680080 - Optimize proc macros / build dependencies. r=glandium,firefox-build-system-reviewers,mhentges
On a very parallel debug build, I see a long time just waiting for
bindgen / style compilation / geckoservo.

Turns out that a bunch of this is just proc macros / build scripts.

Optimizing it saves between 10 and 17 seconds of my debug build. We
might want to consider running bindgen much like cbindgen rather than
rebuilding it all the time, which should help a lot more, but my guess
is that this should still help with the pretty hot custom derives that
the style crate runs.

This needs rust 1.41, so the requirement for tools/crashreporter needs
to be bumped as a consequence. To make things simpler, it was bumped
to 1.47 while we're at it.

Differential Revision: https://phabricator.services.mozilla.com/D98366
2020-12-04 01:35:51 +00:00
Alexis Beingessner
9a0f581986 Bug 1671691 - Enable Rust stdlib instrumentation. r=decoder
* Bumps the tsan toolchain to rust-nightly-2020-11-14 that has my patches to make -Zbuild-std work in vendored environments:
  * https://github.com/rust-lang/cargo/pull/8834
  * https://github.com/rust-lang/rust/pull/78790

* Passes -Zbuild-std to cargo when MOZ_TSAN is defined (mk_add_options --enable-thread-sanitizer)

* Removes generic Rust supressions and adds much more specific ones
    * One presumed upstream false positive from tsan not understanding the code
    * One actual upstream bug tsan found (yay!)
    * One new real issue uncovered
    * One issue that probably already existed intermittently but I happened to hit

Differential Revision: https://phabricator.services.mozilla.com/D97165
2020-11-16 18:36:41 +00:00
Alexis Beingessner
d1d354bb8f Bug 1674773 - make tsan builds use consistent flags. r=rstewart
This makes --enable-thread-sanitizer turn on Rust tsan (-Zsanitizer=thread).
This requires changing SpiderMonkey tsan to use the tsan rust nightly.

In future changes, more Rust tsan integration will key off of MOZ_TSAN.

Differential Revision: https://phabricator.services.mozilla.com/D96453
2020-11-10 21:11:37 +00:00
Cosmin Sabou
f2556d47da Backed out 2 changesets (bug 1674773) for turning Bug 1646925 into almost permafail.
Backed out changeset acd441508a66 (bug 1674773)
Backed out changeset 89babec1b885 (bug 1674773)
2020-11-10 11:27:50 +02:00
Alexis Beingessner
2e16b14340 Bug 1674773 - make tsan builds use consistent flags. r=rstewart
This makes --enable-thread-sanitizer turn on Rust tsan (-Zsanitizer=thread).
This requires changing SpiderMonkey tsan to use the tsan rust nightly.

In future changes, more Rust tsan integration will key off of MOZ_TSAN.

Differential Revision: https://phabricator.services.mozilla.com/D96453
2020-11-09 20:12:42 +00:00
Mike Hommey
0848a4e73a Bug 1644624 - Pass LLVM flags from PROFILE_GEN_CFLAGS to the rust compiler. r=firefox-build-system-reviewers,dmajor
Differential Revision: https://phabricator.services.mozilla.com/D93729
2020-10-20 19:29:58 +00:00
Mike Hommey
6504260166 Bug 1672306 - Don't enable rust "global" LTO when cross LTO is enabled. r=firefox-build-system-reviewers,dmajor
This avoids a sort of duplication of work between both, because the
linker will eventually LTO-compile everything, so we technically don't
really need the extra step of the rust compiler doing an intermediate
LTO on the static libraries it produces.

Differential Revision: https://phabricator.services.mozilla.com/D94224
2020-10-21 01:20:48 +00:00
Cosmin Sabou
b8fd79f461 Backed out 5 changesets (bug 1644624, bug 1671555) for windows shippable bustage.
Backed out changeset fee83fc16940 (bug 1644624)
Backed out changeset afb2a7ff532c (bug 1671555)
Backed out changeset 609ac687f7e3 (bug 1644624)
Backed out changeset d91db0801099 (bug 1644624)
Backed out changeset ce09ad625b53 (bug 1644624)
2020-10-20 06:52:09 +03:00
Mike Hommey
7e240e7af2 Bug 1644624 - Pass LLVM flags from PROFILE_GEN_CFLAGS to the rust compiler. r=firefox-build-system-reviewers,dmajor
Differential Revision: https://phabricator.services.mozilla.com/D93729
2020-10-16 15:45:54 +00:00
Mike Hommey
5afb69830c Bug 1670156 - Use the same prefix/suffix for rust libraries on mingw builds. r=firefox-build-system-reviewers,dmajor
Rustc >= 1.44 changed the file names of the static libraries it
produces with -windows-gnu targets, to match that of mingw clang/gcc.

Considering we still build on 1.43, the best fix would be to derive the
prefix/suffix based on the version of rust, but that actually turns into
a hard-to-solve problem because of configure tests for bindgen also
depending on the prefix/suffix value to be known.

On the other hand, we're soon due to an update to 1.47, so the simpler
solution is to just push mingw builds to require 1.44 (settling for the
smallest upgrade possible for now) and to remove the split between C and
rust library prefix/suffixes.

Differential Revision: https://phabricator.services.mozilla.com/D93726
2020-10-16 16:06:19 +00:00
Ricky Stewart
362abcf949 Bug 1670357 - Remove make targets for cleaning: clean, realclean, clobber, distclean, clobber_all, everything r=firefox-build-system-reviewers,mhentges
The `clobber` targets are superseded by `mach clobber`, so we don't need them for any reason. The `clean` target is meant to get you to a post-`configure` state, but it doesn't really work, and if it's necessary for you to be in that state for some reason you can just clobber and re-`configure`, so it doesn't seem worth it to get it working again. Instead, delete all of them. Also delete `everything` which is not useful when `clobber` doesn't exist.

Differential Revision: https://phabricator.services.mozilla.com/D93514
2020-10-15 20:37:18 +00:00
Mike Hommey
cd3a2d5a79 Bug 1669633 - Remove MOZ_BUILD_ROOT. r=firefox-build-system-reviewers,andi,rstewart
It is only really used in js/src/devtools/rootAnalysis/Makefile.in,
and even there, the way it is used seems wrong, so fix that at the
same time (binaries have been linked into $DIST/bin directly for a
while).

Differential Revision: https://phabricator.services.mozilla.com/D92721
2020-10-07 17:57:38 +00:00
Christian Holler
0215dcbfc4 Bug 1659392 - Only enable rust fuzzing code with libFuzzer. r=truber
Differential Revision: https://phabricator.services.mozilla.com/D87228
2020-08-18 13:32:15 +00:00
Mike Hommey
a34742d98f Bug 1620133 - Allow generated file rules to run in parallel in a given directory. r=firefox-build-system-reviewers,rstewart
Bug 1645986 solved the problem for most generated files by moving their
rules to the top-level, but we're going to add rules that will end up in
subdirectories, so we have to solve the same problem again, in the
subdirectories.

Differential Revision: https://phabricator.services.mozilla.com/D88389
2020-08-28 01:58:48 +00:00
Mike Hommey
ff764980c5 Bug 1659066 - Move base C/C++ compiler flags for cc-rs to CFLAGS_*/CXXFLAGS_. r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D87051
2020-08-22 22:46:12 +00:00
Razvan Maries
60aa2d1349 Backed out 3 changesets (bug 1659066) for build bustages. CLOSED TREE
Backed out changeset e8fdf9f3a551 (bug 1659066)
Backed out changeset 0d9c38d87d51 (bug 1659066)
Backed out changeset bdecbe65a90e (bug 1659066)
2020-08-23 01:39:26 +03:00
Mike Hommey
c47d050d59 Bug 1659066 - Move base C/C++ compiler flags for cc-rs to CFLAGS_*/CXXFLAGS_. r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D87051
2020-08-21 20:18:22 +00:00
Mike Hommey
5919ab86af Bug 1656141 - Create res and rc files based on the name of the binary they are linked into. r=firefox-build-system-reviewers,rstewart
This will allow creating separate res files for e.g. SIMPLE_PROGRAMS.

Differential Revision: https://phabricator.services.mozilla.com/D86155
2020-08-07 00:50:50 +00:00
Mihai Alexandru Michis
c4e805857f Backed out 9 changesets (bug 1656141) for causing multiple failures.
CLOSED TREE

Backed out changeset 9033b0400339 (bug 1656141)
Backed out changeset e43dd57dc61a (bug 1656141)
Backed out changeset eb450457a9b7 (bug 1656141)
Backed out changeset 194a994cf9c9 (bug 1656141)
Backed out changeset ce6831acb5e3 (bug 1656141)
Backed out changeset 29653ea85d49 (bug 1656141)
Backed out changeset 704f28486bda (bug 1656141)
Backed out changeset de8899453150 (bug 1656141)
Backed out changeset 4b133eda46aa (bug 1656141)
2020-08-07 01:48:45 +03:00
Mike Hommey
63984026bb Bug 1656141 - Create res and rc files based on the name of the binary they are linked into. r=firefox-build-system-reviewers,rstewart
This will allow creating separate res files for e.g. SIMPLE_PROGRAMS.

Differential Revision: https://phabricator.services.mozilla.com/D86155
2020-08-06 15:57:42 +00:00
Mike Hommey
2a4eb30ed4 Bug 1654465 - Set -Cembed-bitcode=yes instead of CARGO_PROFILE_RELEASE_LTO. r=firefox-build-system-reviewers,rstewart
It turns out setting CARGO_PROFILE_RELEASE_LTO has unwanted side
effects.

First it's not actually strictly equivalent to using `cargo rustc --
-Clto`. For instance, it apparently also enables cross-language LTO in
newer versions of cargo.

Second, it changes the rust computed hash for all the dependencies of
the crate being built with the variable set, which makes them diverge
from when the same dependencies are built through another crate in the
tree that is not LTOed. This effectively makes us build a _lot_ of
crates twice, many of which are not cacheable.

Since the original problem is that cargo >= 1.45 passes extra flags (`-C
embed-bitcode=no`) to rustc that are incompatible with `-Clto`, and while
it knows to adjust based on the `lto` setting in the build profile
(which CARGO_PROFILE_RELEASE_LTO overrides the default of), cargo
ignores flags passed via `cargo rustc -- ...` when making those
adjustments.

So, we need to override with `-C embed-bitcode=yes` on our own at the
same time we pass `-Clto`. But doing that through `cargo rustc -- ...`
is not enough because all the dependencies of the crate built with
`-Clto` need to be built with `-C embed-bitcode=yes`. So we need to
override with `RUSTFLAGS`, which will affect all the dependencies.
But we also need to do this consistently across all crates, not only the
dependencies of crates built with `-Clto`, otherwise we'd still end up
building crates twice (once with and once without the override).

Unfortunately, the `-C embed-bitcode=*` flag is also not supported in
versions older than 1.45, so we have to avoid adding it on older
versions.

We unfortunately support a large range of versions of rustc (albeit only
for tools/crashreporter), but we actually need to upgrade the smaller
supported version because rustc < 1.38 doesn't support our top-level
Cargo.lock. This makes the version check slightly less awful.

Differential Revision: https://phabricator.services.mozilla.com/D84652
2020-07-27 21:23:57 +00:00
Mike Hommey
268a226874 Bug 1654182 - Only look at the dynamic symbols table for the version checks. r=froydnj
The main reason we look at the complete symbols table is that before bug
1541792, we needed to look at that table for _NSModule symbols.

In bug 1516228, we also made everything llvm-objdump to limit the
differences cross-platform, but that's not necessary anymore per the
previous change.

llvm-objdump doesn't support getting only the dynamic symbols table, so
we go back to what we were using before bug 1516228, namely readelf,
while preserving a code path to use the complete symbols table for the
networking test on libgkrust.a, which doesn't have a dynamic symbols
table.

With this change, check_binary goes from 45s to 0.2s on my machine.

Differential Revision: https://phabricator.services.mozilla.com/D84305
2020-07-22 04:09:39 +00:00
Mike Hommey
cb5b458548 Bug 1640982 - Set CARGO_PROFILE_RELEASE_LTO=true when enabling rust LTO. r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D84098
2020-07-20 16:05:36 +00:00
Mike Hommey
0ebe2bbd8f Bug 1652448 - Use the same codegen-units numbers on host and target rust builds. r=firefox-build-system-reviewers,rstewart
Otherwise, crates that are shared between host and target are always
rebuilt because of the difference in rust flags.

Differential Revision: https://phabricator.services.mozilla.com/D83412
2020-07-13 22:24:59 +00:00
Nathan Froyd
bddb48ea03 Bug 1625281 - force make to update timestamp caches when building rust programs; r=firefox-build-system-reviewers,rstewart
Doing this means that make will correctly understand that the underlying
program has changed and therefore it needs to trigger install rules.

Differential Revision: https://phabricator.services.mozilla.com/D83326
2020-07-13 19:01:40 +00:00
Ricky Stewart
51a23a4ba2 Bug 1651641 - servo/components/style/build.rs reads PYTHON3 configuration value in addition to environment variable r=glandium
The previous logic would check the value of the `PYTHON3` environment variable, which is not set by the Firefox build system, so this build script tends to just use the `python3` at the tip of the `PATH`, regardless of which value you've configured for it. Instead, it should prefer to read from the `OBJDIR` if one is present.

Differential Revision: https://phabricator.services.mozilla.com/D82981
2020-07-09 22:03:23 +00:00