Commit Graph

206 Commits

Author SHA1 Message Date
Jussi Pakkanen 7234316dc7
Merge pull request #6688 from dcbaker/emcc-linker-bugs
Emcc linker bugs and improvments
2020-03-08 14:04:48 +02:00
Martin Storsjö 58db8d5e11 Set c_winlibs/cpp_winlibs for Clang in the same way as for GCC
clang-cl is handled as a separate case (ClangClCCompiler), which already
gets c_winlibs from VisualStudioLikeCCompilerMixin.
2020-03-03 21:49:42 +02:00
Dylan Baker 654f427759 compilers/linkers: Add a representation for wasm-ld
Emscripten does have a stand alone linker, wasm-ld. This patch adds the
linker, adds detection for the linker, and removes the IsLinkerMixin for
emscripten. This is a little more correct, and makes the code a lot
cleaner and more robust.
2020-02-27 16:35:02 -08:00
Dylan Baker 771b0d3ffb compilers/mixins/emscripten: Implement thread support
Emscripten has pthread support (as well as C++ threads), but we don't
currently implement them. This fixes that by adding the necessary code.
The one thing I'm not sure about is setting the pool size. The docs
suggest that you really want to do this to ensure that your code works
correctly, but the number should really be configurable, not sure how to
set that.

Fixes #6684
2020-02-27 16:35:02 -08:00
Dylan Baker 64f3174daa compilers/emcc: Fix inheritance order
Sot hat the BasicLinkerIsCompilerMixin comes before ClangCCompiler,
which hides its "call the linker" methods, as emcc doesn't have a
separate linker.
2020-02-27 16:35:02 -08:00
alanNz 1682058dec -Fixed Renesas RX Family compiler to work with latest meson, updated cross-file, fixed assembly file use 2020-01-30 22:11:26 +02:00
Dylan Baker 0f47ca95c1 compilers: Split ClangCL and MSVC mixins
Instead of checking the compiler id inside the VisualStudioLikeCompiler
class, this creates two subclasses that each represent the divergent
behavior of the two compilers
2020-01-28 10:52:00 -08:00
makise-homura ee6c2c87fc Bringing back defines in Elbrus C compiler to simplify environment.py 2020-01-27 22:37:21 +03:00
makise-homura 7321cc776a Fix missing 'defines' argumet for Elbrus compiler
...But somehow it still remains in C++ compiler.
2020-01-27 22:35:26 +03:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Jussi Pakkanen 7ec3af95e5
Updated linker MR (#6407)
* environment: Fix passing always args to a number of less common linkers

These are mostly (oops xilink) proprietary linkers I can't use for
various reasons.

Fixes: #6332

* Add intelfix from scivision.

* Ifort fix from scivision.

* PGI fix from scivision.

* Cuda fix from scivision.

* Fix linker passing for armclang.
2020-01-06 16:49:34 +02:00
Jussi Pakkanen a2a9611e1d
Merge pull request #6065 from dcbaker/pass-options-to-linker-detection
Pass options to linker detection
2019-12-17 21:09:26 +02:00
Dylan Baker 7f0224fb88 compilers: make use of mlog.log_once
I'm sure there are other places that could use this, but I didn't see
any right off that bat.
2019-12-13 09:57:05 -05:00
Dylan Baker ee6e249f65 compilers: move language attribute to the class level
We know that if a compiler class inherits CCompiler it's language will
be C, so doing this at the class level makes more sense.
2019-12-12 09:35:30 -08:00
Michael Hirsch, Ph.D 83b4e981c4 Use strict function prototypes 2019-11-18 22:21:36 +02:00
Andrei Alexeyev 50646a8723 Refactor duplicate Emscripten code into a mixin 2019-10-18 00:31:57 +03:00
Andrei Alexeyev bd42cb965a Fix emscripten C compiler initialization 2019-10-15 21:52:35 +03:00
Andrei Alexeyev dd162dccaa Implement get_linker_output_args in Emscripten compilers 2019-10-14 13:04:34 -07:00
Andrei Alexeyev 31b8ddab51 Implement get_allow_undefined_link_args in EmscriptenCCompiler 2019-10-14 13:04:34 -07:00
Ting-Wei Lan 9f0f595b35 compilers: Fix version requirements for ClangC and AppleClangC
Commit ff4a17dbef modified the version
requirements wrongly. AppleClangC should be the one with higher version
numbers. Exchange them to fix the check.
2019-10-11 10:03:35 -07:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Dylan Baker ff4a17dbef compilers: Add a specific type for AppleClangC
This allows us to detect use classes rather than methods to determine
what C standards are available.
2019-10-07 10:44:56 -07:00
Dylan Baker 06dcbd50ee compilers: Dispatch to dynamic linker class
Most of the cuda code is from Olexa Bilaniuk.
Most of the PGI code is from Michael Hirsc
2019-08-14 13:13:23 -07:00
Dylan Baker 18b1bf9292 compilers: Make MSVClike compilers proxy extra keyword arguments 2019-08-14 13:13:23 -07:00
Jussi Pakkanen f41bdae368 Add basic Webassembly support via Emscripten. 2019-08-05 19:31:32 +03:00
Martin Liska c1870889b1 Fix missing return statements that are seen with -Werror=return-type.
Error example:

Code:

        #include <locale.h>
        int main () {
            /* If it's not defined as a macro, try to use as a symbol */
            #ifndef LC_MESSAGES
                LC_MESSAGES;
            #endif
        }
Compiler stdout:

Compiler stderr:
 In file included from /usr/include/locale.h:25,
                 from /tmp/tmpep_i4iwg/testfile.c:2:
/usr/include/features.h:382:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  382 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
/tmp/tmpep_i4iwg/testfile.c: In function 'main':
/tmp/tmpep_i4iwg/testfile.c:8:9: error: control reaches end of non-void function [-Werror=return-type]
    8 |         }
      |         ^
cc1: some warnings being treated as errors
2019-07-16 09:49:03 +02:00
Dylan Baker fab47c5680 compilers: split pgi compiler out of compilers module 2019-07-15 10:59:22 -07:00
Dylan Baker 5d685e7a5c compilers: put elbrus in mixins 2019-07-15 10:59:22 -07:00
Dylan Baker bc4438b34f compilers: Put clang mixin in a module 2019-07-15 10:59:22 -07:00
Dylan Baker e879992114 compilers: move ArmClang into mixins/arm.py 2019-07-15 10:59:22 -07:00
Dylan Baker b8368c1617 compilers: Put Intel compiler classes into the mixins folder 2019-07-15 10:59:22 -07:00
Dylan Baker cd5360821a compilers: split gnu and gnulike compilers out of compilers
I debated a bit whether both classes really belong in the same module,
and decided that they do because the share a number of helpers.
2019-07-15 10:59:22 -07:00
Dylan Baker 214ab455d3 compilers: Move the VisualStudioLikeCompiler class into mixins 2019-07-15 10:59:22 -07:00
Dylan Baker ef448b95ae compilers: Move ArmCompiler to a mixin module 2019-07-15 10:59:22 -07:00
Dylan Baker 4d5c745bdc compilers: move ccrx compiler abstraction into mixins 2019-07-15 10:59:22 -07:00
Dylan Baker d483da46a9 compilers: Move clike into a mixins directory
The compilers module is rather large and confusing, with spaghetti
dependencies going every which way. I'm planning to start breaking out
the internal representations into a mixins submodule, for things that
shouldn't be required outside of the compilers module itself.
2019-07-15 10:59:22 -07:00
David Seifert fcf27c2a2d Do not fail on passing `-Werror=unused-parameter` from environment 2019-07-14 15:12:16 +00:00
Michael Hirsch, Ph.D c756d06fbb
add clang c_std=c18 alias
fix unit test skips for clang c18

correct unittests clang minimum version

cleanup unittest clang skip c_std

finesse unittest vs. clang version
2019-07-08 22:27:35 -04:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
Dylan Baker 5065db86f2 compilers/c: Fix removal of name from Combo options for ICL 2019-06-06 01:57:13 +03:00
John Ericson 4030e7cb7a UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its
name, and also contains its own name. In general, the maxim in
programming is things shouldn't know their own name, so removed the name
field just leaving the option's position in the dictionary as its name.
2019-05-15 14:21:47 +03:00
Dylan Baker fa54f05f09 compilers: Add basic ICL abstractions 2019-05-13 11:22:31 -07:00
Dylan Baker 080f59cf43 compilers: rename IntelCompiler to IntelGnuLikeCompiler
The Intel compiler is strange. On Linux and macOS it's called ICC, and
it tries to mostly behave like gcc/clang. On Windows it's called ICL,
and tries to behave like MSVC. This makes the code that's used to
implement ICC support useless for supporting ICL, because their command
line interfaces are completely different.
2019-05-13 11:22:31 -07:00
Dylan Baker 541523eeba compilers: Split C-Like functionality into a mixin classes
Currently C++ inherits C, which can lead to diamond problems. By pulling
the code out into a standalone mixin class that the C, C++, ObjC, and
Objc++ compilers can inherit and override as necessary we remove one
source of diamonding. I've chosen to split this out into it's own file
as the CLikeCompiler class is over 1000 lines by itself. This also
breaks the VisualStudio derived classes inheriting from each other, to
avoid the same C -> CPP inheritance problems. This is all one giant
patch because there just isn't a clean way to separate this.

I've done the same for Fortran since it effectively inherits the
CCompiler (I say effectively because was it actually did was gross
beyond explanation), it's probably not correct, but it seems to work for
now. There really is a lot of layering violation going on in the
Compilers, and a really good scrubbing would do this code a lot of good.
2019-05-03 10:36:50 -07:00
Dylan Baker da5f07cf39 Revert "detect Intel ICL on windows"
This reverts commit 3a75bb5259.
2019-05-02 14:56:23 -07:00
Dylan Baker c0aa89e57f
Merge pull request #4952 from mensinda/cacheCompiles
Cache compilers.compile() in coredata
2019-05-02 14:54:02 -07:00
Daniel Mensinger bf98ffca9e
Fix blind exceptions 2019-04-29 12:16:06 +02:00
Daniel Mensinger c61ae46461
Moved caching into a seperate function 2019-04-28 14:33:22 +02:00
Daniel Mensinger 8a32fc8dbe
Disable cache for dependencies 2019-04-28 14:33:22 +02:00
Daniel Mensinger 210fe5bf40
Add option to disable the cache 2019-04-28 14:33:21 +02:00