Commit Graph

333 Commits

Author SHA1 Message Date
gingerBill 15f7148eae Merge pull request #3526 from laytan/target-features
Improve target features support
2024-05-05 21:50:57 +01:00
Feoramund 1165d65c94 Minimally support compiling Odin on FreeBSD arm64
This is enough to get Odin itself compiling and the demo running.
2024-05-05 07:26:45 -04:00
Laytan Laats 25f1d0906d compiler: improve target features support 2024-05-02 00:59:52 +02:00
Laytan Laats 4fea5720a5 wasm: allow -default-to-nil-allocator 2024-04-28 16:05:41 +02:00
Laytan d1a1e8f646 fix linking with clang-18
Because we currently just use the clang from the user's path linking
suddenly breaks when the user updates their system clang to 18 with an
error about an unknown option -arch.

I had already fixed it for my LLVM 18 PR but it seems like a good idea
to get this in already to avoid that breakage (had a few people come to
the Discord with it and an issue).

This fixes #3461
2024-04-22 20:58:54 +02:00
Thomas la Cour 0a16f7a6f1 normalize_path 2024-04-20 09:37:30 +02:00
gingerBill ece78d22d2 Add -no-type-assert and ODIN_NO_TYPE_ASSERT 2024-04-18 11:22:31 +01:00
gingerBill cb0a57eaa9 Add -target:freestanding_amd64_win64 2024-04-11 17:18:51 +01:00
gingerBill b6d2ac11b8 Add -vet-unused-variables and `-vet-unused-imports (-vet-unused is both) 2024-04-11 15:24:36 +01:00
gingerBill 7f0ca315b3 Merge pull request #3374 from laytan/fix-128-ints-alignment-arm64
fix 128 bit int alignment on arm64
2024-04-04 18:06:01 +01:00
Laytan Laats 31407d9b1b fix 128 bit int alignment on arm64
Fixes #2403
2024-04-04 18:39:41 +02:00
gingerBill 0e5a482c42 Default to "smart" linker behaviour; Add -min-link-libs to use minimize link libs if wanted 2024-04-04 16:11:26 +01:00
Laytan Laats 9a5a39c07d fix not setting ok in cached code path 2024-03-28 19:16:55 +01:00
Laytan Laats 63f30a8207 speed up path_to_fullpath on Linux/MacOS
We did some profiling for #3343 and this seems to be the biggest
problem. `realpath` is expensive, and we are locking here for no reason
that I can think of.

This improves the "check procedure bodies" timing (of the linked issue)
from 2.4s to .4s on my machine.
2024-03-28 18:44:21 +01:00
Laytan Laats b26a685b76 darwin: be less annoying about "incompatible" library versions
After #3316 we set a default minimum version, now this will warn if you
link with a library that is targeting later versions.

This might be a bit annoying, especially when the user hasn't actually
given Odin a minimum target.

So this PR makes these warnings only show when you explicitly give a
target version (afaik that is the only thing that -mmacosx-min-version
actually does for us because we don't use it to compile anything, just
to link).
2024-03-25 22:11:20 +01:00
Laytan Laats 15c1e8274d darwin: fix ld warnings and set minimum os version 2024-03-23 22:12:05 +01:00
Laytan Laats f312adb26a darwin: allow cross linking darwin_amd64 from darwin_arm64 2024-03-20 17:44:35 +01:00
gingerBill 863ee0b8d1 Merge pull request #3297 from laytan/linker-improvements
linker improvements
2024-03-20 10:09:45 +00:00
Laytan Laats a555862522 linker improvements
`path_to_fullpath` did different things on Windows&Unix, an attempt to
bring them closer together was made here.
This was prompted by the compiler completely ignoring
`foreign import "foo.dylib"` when `foo.dylib` does not exist (because
`path_to_fullpath` returns an empty string).
Causing just unresolved symbol errors, when on Windows it would pass
along the path to the linker and actually say it doesn't exist, which
is now also the case for Unix.
This also fixes some checker errors that relied on the Windows
behaviour, for example: `Error: File name, , cannot be as a library name
as it is not a valid identifier`.

Made `-no-crt` require either `-default-to-nil-allocator` or
`-default-to-panic-allocator` on Unix, the current default allocators
rely on libc and this was not obvious and would immediately bring up
unresolved symbol errors for the linked memory management functions, or
just link with libc anyways because it was foreign imported.

Added a suggestion to install `nasm` with the user's package manager
when assembling using `nasm` fails on Unix, I saw some confusion about
it in the Discord.

Ignore explicit foreign imports of libc. It is already linked in later
on in the linking process and would otherwise (at least on macOS) cause
linker warnings for duplicate libraries. This also makes it so when
using `-no-crt` and importing something that requires libc, linker
errors are given (like I would expect), instead of silently still
linking with libc because it was foreign imported.
2024-03-19 19:57:35 +01:00
gingerBill ba428fecdb Add -json-errors 2024-03-19 16:25:09 +00:00
gingerBill 9a2fc6cf4c Serialize errors to make them sortable, deterministic, and generally more control 2024-03-19 15:34:29 +00:00
avanspector fca691a066 fix core:thread and a memory leak
in the future probably native non-pthread implementation for haiku will be required
2024-02-27 02:38:06 +01:00
avanspector 0fa6ba726f add haiku build token 2024-02-25 03:03:12 +01:00
avanspector 24c8b15409 small fixes 2024-02-25 02:38:35 +01:00
avanspector 88add0b6b1 Improve Haiku support 2024-02-25 02:24:52 +01:00
Laytan Laats a8c4f46747 fix ci 2024-02-07 19:53:52 +01:00
gingerBill a08250ac5b Improve error handling for missing library collection provided by the compiler 2024-02-07 17:15:59 +00:00
gingerBill 9fb090d1b8 Merge pull request #3141 from laytan/add-all-packages-flag-for-tests
Add `odin test -all-packages` to be able to test an entire project
2024-01-31 11:59:54 +00:00
gingerBill 6a07effdd2 Freestanding - default to nil allocator; wasm - default to panic allocator 2024-01-28 22:15:28 +00:00
gingerBill 395e0fb225 -default-to-panic-allocator 2024-01-28 22:09:20 +00:00
gingerBill 09fa1c29cd Move core:runtime to base:runtime; keep alias around 2024-01-28 21:05:53 +00:00
Laytan Laats 31914e9cb9 Add odin test -all-packages to be able to test an entire project 2024-01-26 18:27:05 +01:00
Jeroen van Rijn fc047a8043 Expand -subsystem option on Windows
W:\Odin>odin run sketch.odin -file -subsystem:foo
Invalid -subsystem string, got oo. Expected one of:
        BOOT_APPLICATION, CONSOLE (default), EFI_APPLICATION, EFI_BOOT_SERVICE_DRIVER, EFI_ROM, EFI_RUNTIME_DRIVER, NATIVE, POSIX, WINDOWS (or WINDOW), WINDOWSCE

We now also set the constant ODIN_WINDOWS_SUBSYSTEM, which is "" for non-Windows targets.
2024-01-18 19:12:39 +01:00
Jeroen van Rijn ae52e245ea Add WINDOWS_SUBSYSTEM constant bool
true when -subsystem:windows for Windows targets, false otherwise.
2024-01-18 17:42:03 +01:00
codename-irvin 0fcd2f1d88 Use default calling convention for arm target for now - not 100% sure this is correct 2024-01-16 10:47:25 -05:00
codename-irvin 76f52dd6c9 Add freestanding aarch64 target 2024-01-15 19:49:34 -05:00
Yawning Angel cd65a15d81 src: enable_target_feature should add features, not overwrite
`llvm_features` being empty is the default state, and implies the
presence of certain features.

Previously if any target features were explicitly enabled by the
`enable_target_feature` attribute, they were added comma separated
to `llvm_features`.

For example: `lzcnt,popcnt,...,sse4.2,sse`

This was causing LLVM to try to target a CPU that *ONLY* has the
explicitly enabled features.  This now will prefix explicitly enabled
features with a `+`, and preserve the existing `llvm_features` string
by appending to it if it is set.
2024-01-07 20:04:40 +09:00
gingerBill d7d23e65ea Clean up error block usage 2024-01-05 13:47:00 +00:00
gingerBill ca2b2c498e Add -obfuscate-source-code-locations 2023-12-13 16:47:34 +00:00
Jeroen van Rijn f903951016 Facored out get_default_microarchitecture
Moved `generic` -> `x86-64-v2` selection into its own procedure so that `llvm_backend.cpp` and `main.cpp` can share the same logic.
2023-11-10 20:14:00 +01:00
Jeroen van Rijn e19460cbd7 Add -microarch:? 2023-11-10 19:37:08 +01:00
gingerBill 1d9f6346d4 Force dynamic map calls on non-windows targets 2023-10-29 17:23:24 +00:00
gingerBill c8a5bafc6b Fix static map calls and default to them! 2023-10-27 14:53:48 +01:00
gingerBill 1f643b5816 Remove -vet-extra 2023-09-30 18:29:18 +01:00
gingerBill 70aff9fbb2 Update src/build_settings.cpp
Co-authored-by: Laytan Laats <laytanlaats@hotmail.com>
2023-09-27 14:01:45 +01:00
gingerBill 4aa9d34b3d Add attributes for sanitize_memory and sanitize_thread 2023-09-21 11:20:13 +01:00
gingerBill e82b0ea4cd Add -o:aggressive for LLVM 17 2023-09-21 09:48:53 +01:00
gingerBill 2160484b62 Support -sanitize:<string> for address, memory, thread for LLVM 17 2023-09-21 09:40:33 +01:00
gingerBill 939bf4bb5d Add experimental -subtarget:ios 2023-08-08 11:35:51 +01:00
gingerBill b495a302b0 Merge branch 'master' into tilde 2023-08-03 13:14:09 +01:00