The desired outcome of this change is that we'll set
-Wl,--version-script based on linker kind and not on the output of
$LINKER -v.
This is a cheap way to address a simple problem that has a complicated
ideal solution. The underlying issue is that in some situations, when
targeting Android, a macOS system ld is interrogated to determine if
a cross-compiling linker "is GNU ld" and a particular linker feature
is set in that situation. The macOS system ld doesn't pass the "is
GNU ld" test, and the linker feature isn't set; that causes link
failures, even though the actual linker has nothing to do with the
system ld.
The ideal solution is to test for linker capabilities dynamically. We
do a lot of that in old-configure.in, and we don't do any of that in
toolchain.configure. Rather than start testing in
toolchain.configure, we hard-code: a cheap solution to the immediate
problem.
MinGW suffers somewhat from the opposite problem: the linker "is GNU
ld" (compatible), but the linker checks don't happen at all. We hard-code
for MinGW based on the C compiler instead.
Differential Revision: https://phabricator.services.mozilla.com/D8471
--HG--
extra : moz-landing-system : lando
The desired outcome of this change is that we'll set
`-Wl,--version-script` based on linker kind and not on the output of
`$LINKER -v`.
This is a cheap way to address a simple problem that has a complicated
ideal solution. The underlying issue is that in some situations, when
targeting Android, a macOS system `ld` is interrogated to determine if
a cross-compiling linker "is GNU ld" and a particular linker feature
is set in that situation. The macOS system `ld` doesn't pass the "is
GNU ld" test, and the linker feature isn't set; that causes link
failures, even though the actual linker has nothing to do with the
system `ld`.
The ideal solution is to test for linker capabilities dynamically. We
do a lot of that in old-configure.in, and we don't do any of that in
toolchain.configure. Rather than start testing in
toolchain.configure, we hard-code: a cheap solution to the immediate
problem.
Differential Revision: https://phabricator.services.mozilla.com/D8471
--HG--
extra : moz-landing-system : lando
The GNU_AS check in old-configure depended on running with the value
of $AS before it gets reset to just be the C compiler, which breaks when
we move setting AS into moz.configure.
This patch moves the GNU_AS check to toolchain.configure and changes it
so that it works when the assembler is the C compiler. We do have to
fix things slightly for clang, because the previous check was
succeeding, but not because of clang: it was detecting the presence of
"GNU" in the output for GNU ld/gold and a message about the GNU GPL.
This is a straightforward port of MIDL_FLAGS from old-configure to
moz.configure. The only behavioral change is that it removes support for
prepending MIDL_FLAGS from the environment in configure, but I doubt anyone
uses that.
This is a fairly straightforward port of the AS tool checks from old-configure
to toolchain.configure. AS is a little quirky in that we currently do a
normal-looking check for it, but then override that value to be the C compiler
for non-Windows builds, and ml[64]/armasm64 for Windows builds.
After migrating those checks, the only things left in the MOZ_DEFAULT_COMPILER
macro in compiler-opts.m4 were some unused bits, so I removed them:
* Setting of CPP/CXXCPP, which are set in toolchain.configure now
* Setting HOST_LDFLAGS to empty, which doesn't seem particularly useful.
There was also a quirky old test that the assembler was ml[64] when js-ctypes
is enabled that I removed, I don't think it provides any value since this
patch will ensure that we're using the right assembler for Windows builds.
Some build flags are being passed by the build system: they're passed in a text
file called extra-bindgen-flags.in that's filled at configure time.
Other flags have to be inferred from the current target/host combination, in
Cranelift's build script directly. This is mostly cargo-culted from the
ServoBindings.toml file, and should probably be merged in the build system at
some point.
Some Windows-specific adjustments were needed to provide access to libclang for
bindgen support, by adding clang-cl to the plain Spidermonkey Windows builds.
--HG--
extra : rebase_source : 0bda40b1d1eb38c2657593f094c951013711d00a
extra : histedit_source : aad930a5f9099e299d385ae4de2deb81aed9b6d5
It's nicer to have all that logic in one place, and to be able to common
up the Unix-y flags setting. The Makefile constructs in string values
is gross, but it's no worse than we had before.
clang doesn't recognize --enable-stdcall-fixup as an option. We needed this for the
mingw-gcc build (added in Bug 787653) because gcc had difficulty dealing with
Angle's symbol linking
Differential Revision: https://phabricator.services.mozilla.com/D6072
--HG--
extra : moz-landing-system : lando
Currently mozconfig.cache overrides a few build options for sccache.
This patch moves them into toolchain.configure so that the build system
will set them properly when sccache is in use. Additionally,
{CC,CXX}_WRAPPER are set in config.mk, so just avoid setting them when
sccache is in use.
On 64-bit Android, `pthread_cond_timedwait_monotonic_np` is only
available for API 28+. The issue is, even though the NDK header does not
define `pthread_cond_timedwait_monotonic_np` for API 27 and below, the
NDK library _does_ include the function (in order to support builds
targeting API 28+).
During our configure test, the compiler only emits a warning about
`pthread_cond_timedwait_monotonic_np` being undefined, but linking
succeeds because the function is present in the library. Because linking
succeeds, the test inadvertently passes. This patch adds a '-Werror'
flag to the compilation, so the warning turns into an error to make the
test fail.
Differential Revision: https://phabricator.services.mozilla.com/D4482
AArch64 Windows includes the necessary DLL in its default configuration,
so we don't need to bother locating it in the SDK. We made need to
distribute an updated version that won't by on the system by default,
though, so we need some extra checking.
BFD ld's --build-id means --build-id=sha1, but with lld it means
--build-id=fast. Both support the explicit --build-id=sha1, so use that.
Gold supports --build-id=sha1 too.
ld64, used for mac builds doesn't support neither --build-id=sha1 nor
--build-id.
-DEBUGTYPE:CV, -NXCOMPAT, and -DYNAMICBASE are on by default in both link.exe and lld-link.
--HG--
extra : rebase_source : 3b50b88bb8ac9257689df2e10146906ef9962b08