Commit Graph
105 Commits
Author SHA1 Message Date
Yawning Angel 9aa84b5e3a src: Use posix_spawnp instead of system() when invoking the linker
Thanks to Matteo on discord for pointing this out.
2026-08-31 04:40:04 +09:00
Michael Tesař 56c49287a6 Fix default linker timing label on non-Windows platforms 2026-08-06 22:08:28 +02:00
Jeroen van Rijn 6154d5c577 Further LLVM 14 support removal. 2026-06-30 21:16:48 +02:00
Jeroen van Rijn 47cf0d3f42 Merge pull request #6790 from A1029384756/linux_pie
[linux] change default settings to enable pie and full relro
2026-06-12 11:21:51 +02:00
A1029384756 43b057dfeb [linux] change default settings to enable pie and full relro 2026-06-06 21:23:26 -04:00
lualvsil 1b07372547 AArch64 assembly support for foreign import 2026-06-05 23:23:50 -03:00
Ignacy Koper d1915fa6f5 removed Haiku from compiler targets, and tests
Signed-off-by: Ignacy Koper <ignacy423@gmail.com>
2026-04-28 19:27:23 +02:00
Ignacy Koper 3e64a72bad removed Essence from supported targets
Signed-off-by: Ignacy Koper <ignacy423@gmail.com>
2026-04-27 11:10:48 +02:00
xfitgd b965e46d7c fixes Android build 2026-03-19 08:27:09 +09:00
gingerBill 2de214418c Fix LTO with debug info by passing -g 2026-03-15 21:29:54 +00:00
Andrés Botero 9df092759e Add support for other Android architectures 2026-03-11 15:37:37 -05:00
Jesse Meyer b8276065f9 Merge branch 'master' into lto-support 2026-02-03 20:52:52 -05:00
Jesse MeyerandClaude Opus 4.5 a0562dfd6e Fix lld-link LTO jobs flag syntax on Windows
lld-link doesn't recognize /lldltojobs:N as a standalone flag and
treats it as a file path. Use /opt:lldltojobs=N instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:16:20 -05:00
Jesse MeyerandClaude Opus 4.5 43ad4a1d9f Add ThinLTO support via -lto:thin and -lto:thin-files flags
- Add -lto:thin and -lto:thin-files CLI flags with validation
- Emit LLVM bitcode (.bc) instead of object files when LTO is enabled
- Pass -flto=thin and -flto-jobs to clang/lld linkers
- Guard linkage corrections to skip declarations without definitions
  (required for LTO where declarations appear across modules)
- Allow module-per-file with LTO even at higher optimization levels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:16:20 -05:00
gingerBill f3daaa62fe Merge pull request #6220 from laytan/fix-lto-macos
fix LTO on MacOS
2026-02-02 18:46:18 +00:00
Laytan Laats afbbb829ea fix LTO on MacOS
If no `-minimum-os-version` is given, ignore the `override-module`
warnings. The user not using, `-minimum-os-version` opts you into linker
warnings about target versions.

If a `-minimum-os-version` is provided, normalize it to a full version
`11` to `11.0.0` for example. The linker seems to want that when doing
LTO.
2026-02-02 18:13:48 +01:00
Jeroen van Rijn 6a07f70c1c support -> supported 2026-02-02 17:57:50 +01:00
Jesse MeyerandClaude Opus 4.5 1a7f78b665 Add ThinLTO support via -lto:thin and -lto:thin-files flags
- Add -lto:thin and -lto:thin-files CLI flags with validation
- Emit LLVM bitcode (.bc) instead of object files when LTO is enabled
- Pass -flto=thin and -flto-jobs to clang/lld linkers
- Guard linkage corrections to skip declarations without definitions
  (required for LTO where declarations appear across modules)
- Allow module-per-file with LTO even at higher optimization levels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:04:53 -05:00
gingerBill 7125782bd2 Support -linker:mold on FreeBSD and NetBSD; Remove -use-lld and -use-radlink 2026-01-30 10:46:35 +00:00
Fabrice 622fa818bc Adds static linking to non-windows platforms (#6057) 2026-01-13 20:56:40 +01:00
Wrath 6356cadfcc Fix orca linking path 2025-10-15 10:08:44 -04:00
gingerBill 5f76d6ce15 Support -linker:mold 2025-09-19 10:25:11 +01:00
Jon Lipstate 231ce2da59 windows i386 support 2025-08-29 12:41:38 -07:00
Harold Brenes bab4ce11fc Rename iOS subtarget to iPhone for consistency.
Add `ODIN_PLATFORM_SUBTARGET_IOS` builtin constant which evaluated to
`true` when the platform is `Darwin` and the subtarget it either `iPhone` or `iPhoneSimulator`
2025-07-14 21:55:28 -04:00
Harold Brenes 77e5c71414 Fix correct versioned target triplet for iphonesimulator subtarget
- Always set the `-m*-version-min` linker flag for non-macOS Darwin subtargets
2025-07-14 14:28:07 -04:00
Harold Brenes 070943aa98 Provide default minimum version for iOS and apply its target triplet.
- Fix incorrect clang_path override for iOS during link stage.
2025-07-14 12:59:25 -04:00
Harold Brenes 4d2d890b4c Fix accidental incorrect assignment 2025-07-13 20:29:54 -04:00
Harold Brenes 0e245fb40f Updated iOS/iPhoneSimulator build support 2025-07-13 20:17:30 -04:00
xenobas 0ed54d3557 fix: escape object files with single quotes during linking 2025-06-20 19:40:24 +01:00
Feoramund 1fc390146f Let -no-entry-point work for Windows DLLs
Fixes #4660
2025-06-10 08:54:28 -04:00
Jeroen van Rijn 405bf7cd55 Also clean up .dSym on Darwin 2025-06-01 15:59:38 +02:00
Jeroen van Rijn 0d0f311df1 Always provide /PDB option to linker if generating debug info.
radlink by default places the .PDB file in the working directory, even if /OUT says to place it elsewhere,
unlike link.exe, which places it next to the executable by default.

So, if compiling using -debug, we generate a PDB path even if -pdb-name wasn't used to override it.
2025-05-29 19:02:46 +02:00
Jeroen van Rijn 229c734820 Add comments to builtin.odin, documenting ODIN_* constants. (#5218)
And document constants not previously listed.
2025-05-26 18:58:59 +02:00
Feoramund 6c5b96948e Enable all sanitizers on FreeBSD 2025-05-22 21:39:35 -04:00
Feoramund c090a28b9d Add /usr/local/lib to FreeBSD linker path 2025-05-20 18:56:18 -04:00
Feoramund 591118c688 Use --sysroot instead of -Wl,-syslibroot on Darwin
This keeps the linker from using the wrong SDK and mirrors how we build
the Odin compiler itself in `build_odin.sh`.
2025-05-18 11:11:02 -04:00
Romāns Potašovs dc75ee72ae add quotes for absolute path 2025-04-09 15:31:34 +03:00
IllusionMan1212 af91dd7c7a android: always link liblog 2025-04-08 01:30:55 +02:00
IllusionMan1212 7d2a8dc8ee fix: use the clang binary that's provided by the android NDK
always link against libandroid because it's needed by the glue code.
2025-04-07 13:02:14 +02:00
Hisham Aburaqibah 106427b127 fix(android): pass --sysroot when compiling the android glue code
This prevents a `function-like macro '__GLIBC_USE' is not defined`
compilation error from happening with newer NDK versions (I tried r28)
2025-04-05 15:18:27 +02:00
IllusionMan1212 2328e84077 fix cross compilation for linux_riscv 2025-04-05 15:18:21 +02:00
IllusionMan1212 44950d5f37 fix: cross-compilation for android on linux
add `-nodefaultlibs` when cross-linking for android to prevent clang from linking with libgcc

check build mode first before calling `init_android_values` to prevent printing a message
that tells the user to set `-android-keystore` if its not set and build mode is exe
2025-04-05 02:20:06 +02:00
gingerBill edf97bdb03 Merge pull request #4970 from odin-lang/bill/android-subtarget
Very Very Rudimentary Support for Android
2025-03-28 09:02:26 +00:00
Dave Voutila 5274aa53b3 Fix linker invocation on OpenBSD.
Firstly, we need to explicitly request pthreads and also need to
mind the fact ports (like SDL2) install in /usr/local/lib.

Secondly, since OpenBSD 7.4 the system enforces indirect branch
targets on hardware platforms that support it. Until the LLVM
integration in Odin can be changed to emit proper branch targets
(e.g. endbr64 on amd64), we need to request the linker make the
resulting program opt-out of enforcement.
2025-03-27 10:37:36 -04:00
gingerBill f13a075cd1 Begin work on odin package-android command 2025-03-26 18:03:36 +00:00
gingerBill eee450516e Improve bodge for android execute build 2025-03-26 17:45:04 +00:00
gingerBill 45ecafd7b1 Really bodgy android packing system for odin build 2025-03-26 17:33:10 +00:00
gingerBill 8e884c6292 Remove _PATH on android environment variables 2025-03-26 16:50:35 +00:00
gingerBill d48e7bb0b8 Migrate ODIN_ANDROID_* constants to build_settings.cpp; -minimum-os-version:<int> for -subtarget:android 2025-03-26 16:05:21 +00:00
gingerBill 518634405c Add -show-more-timings for Android stuff 2025-03-26 13:28:57 +00:00