Previously, any value other than `windows` or `console` caused an
exception. This change allows for `efi_application` to be passed as
the `win_subsystem` to MinGW based linkers.
[why]
Support for the relatively new mold linker is missing. If someone wants
to use mold as linker `LDFLAGS="-B/path/to/mold"` has to be added instead
of the usual `CC_LD=mold meson ...` or `CXX_LD=mold meson ...`.
[how]
Allow `mold' as linker for clang and newer GCC versions (that versions
that have support).
The error message can be a bit off, because it is generic for all GNU
like compilers, but I guess that is ok. (i.e. 'mold' is not listed as
possible linker, even if it would be possible for the given compiler.)
[note]
GCC Version 12.0.1 is not sufficient to say `mold` is supported. The
expected release with support will be 12.1.0.
On the other hand people that use the un-released 12.0.1 will probably
have built it from trunk. Allowing 12.0.1 is helping bleeding edge
developers to use mold in Meson already now.
Fixes: #9072
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Using future annotations, type annotations become strings at runtime and
don't impact performance. This is not possible to do with T.cast though,
because it is a function argument instead of an annotation.
Quote the type argument everywhere in order to have the same effect as
future annotations. This also allows linters to better detect in some
cases that a given import is typing-only.
Since they will never be used outside of the build directory, they do
not need to literally contain the .o files, and references will be
sufficient.
This covers a major use of object libraries, which is that the static
library would potentially take up a lot of space by including another
copy of every .o file.
Fixes#9292Fixes#8057Fixes#2129
The `init__()` method basically existed solely to be overridden by every
derivative class. Better to use it only in the class that needs it.
This fixes several warnings, including missing calls to init because we
skipped ArLinker due to not wanting it... also get rid of a pointless
popen return code saved as pc, which we never checked.
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
For an ELF targets, shared_module() builds a module with SONAME field
(using -Wl,-soname argument). This is wrong: only the shared_library()
needs SONAME, while shared_module() does not. Moreover, tools such as
debian's dpkg-shlibdeps use presence of SONAME field as an indicator
that this is shared library as opposed to shared module (e.g., for the
module it is okay to have unresolved symbols which are imported from
the executable which loads the module, while a library should have all
symbols resolved).
This was in fact already the behavior on Darwin; extend it to ELF
targets as well.
Fixes: #8746
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
All changes were created by running
"pyupgrade --py3-only --keep-percent-format"
and committing the results. I have not touched string formatting for
now.
- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
The svr4 linker flag causes issues, especially when compiling c++.
Replace '-z' options with the equivalent non-svr4 flags. When using
-blibpath, we must be careful to include the default system library
path, or the resulting executables will not be able to find libc.
This patch was suggested by @andreaskem in #7581.
This has a bunch of nice features. It obviously centralizes everything,
which is nice. It also means that env is only re-read at `meson --wipe`,
not `meson --reconfigure`. And it's going to allow more cleanups.
Applies the changes made to GnuLikeDynamicLinkerMixin by
commit d7235c5905 to SolarisDynamicLinker
This makes test_build_rpath pass with the Solaris linker, where before
this change it failed with:
New rpath must not be longer than the old one.
Old: $ORIGIN/sub:/foo/bar
New: /baz:$ORIGIN/sub:/foo/bar
FAILED: meson-install
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
lld in gnu like mode (e.g. for mingw) needs these options in
the same for as gnu ld, thus remove the lld specific code bit
and move the code for gnu like options into GnuLikeDynamicLinkerMixin.
This unbreaks linking with lld for mingw targets after
2fb4d1f751.
Projects that specify b_pie=true clutter build logs with the warning:
clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
No option is needed to produce PIE binaries because ld64 is making PIE
executables on 10.7 and above by default, as documented in ld(1).
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
We do this by making the mixins inherit the Compiler class only when
mypy is examining the code (using some clever inheritance shenanigans).
This caught a bunch of issues, and also lets us delete a ton of code.
1. Like with gcc's `ld`, also use the `group_start` code to create a
`--start-group`/`--end-group`
2. xc16 tricked into believing the 'link_whole' was about `--*-group`,
but it should use gcc's `--whole-archive` instead.
3. Not clear what the get_lib_prefix should really do, but for picolibc
it seems I want just `''`.
The problem with picolibc was that the `-l` would be prefixed to a lib
like `picolib/libm/libm.a`. Though of course the `-l` would be necessary
for just a plain `m` (that's what I assumed this would be used for).
I think this might need some clarification from the meson devs ;-)
Originally I had this idea that you'd be able to pass the id in to be
able to deduplicate some cases (like ld.gold and ld.bfd). That went away
because it ended up being really un-dry, but this id per instance
remained. Getting rid of it allows us to get rid of a bunch of otherwise
useless super calls, which makes adding type annotations easier.