Commit Graph

432 Commits

Author SHA1 Message Date
Jeroen van Rijn
3cab2592c3 Compiler: Add early error for output path being a directory.
- Introduce new `Path` type and an array of build paths on the build context.
- Resolve input and output paths/files early (before parsing).
- Error early if inputs are missing or outputs are directories.
- Plumb new file path generation into linker stage instead of its adhoc method.

TODO:
- Remove more adhoc file path generation in parser and linker stage.
- Make intermediate object file generation use new path system.
- Round out and robustify Path helper functions.
2022-04-24 13:37:26 +02:00
Jeroen van Rijn
bb9165edd2 Add -help to CI tests. 2022-04-05 20:45:00 +02:00
Jeroen van Rijn
ad0a413b40 Give build/run/check/test/doc a -file flag.
A package has canonically always been a directory, but odin allowing you to build a single-file package confused newcomers who didn't understand why they could then not access variables and procedures from another file in the same directory.

This change disallows building single-file packages by default, requiring the `-file` flag to acknowledge you understand the nuance.

`-help` for these commands also clarifies the difference.

```
W:\Odin>odin build -help
odin is a tool for managing Odin source code
Usage:
        odin build [arguments]

        build   Compile directory of .odin files as an executable.
                One must contain the program's entry point, all must be in the same package.
                Use `-file` to build a single file instead.
                Examples:
                        odin build .                    # Build package in current directory
                        odin build <dir>                # Build package in <dir>
                        odin build filename.odin -file  # Build single-file package, must contain entry point.

        Flags

        -file
                Tells `odin build` to treat the given file as a self-contained package.
                This means that `<dir>/a.odin` won't have access to `<dir>/b.odin`'s contents.
```

```
W:\Odin>odin run examples\demo\demo.odin
ERROR: `odin run` takes a package as its first argument.
Did you mean `odin run examples\demo\demo.odin -file`?
The `-file` flag tells it to treat a file as a self-contained package.
```
2022-04-05 20:26:18 +02:00
Jeroen van Rijn
2e6ad2a711 Add extra help line for define/config. 2022-04-03 21:06:06 +02:00
gingerBill
abf0fd7efc Merge pull request #1671 from colrdavidson/add_nocrt
Make no crt work on Linux
2022-03-30 12:58:12 +01:00
Colin Davidson
a632db3618 Make no crt work on Linux 2022-03-30 04:45:22 -07:00
gitlost
8661457512 Use WIFEXITED() and WEXITSTATUS() on Unix system() exit code
(ensures Odin run returns correct exit code of built executable)
Adds test "tests/core/os/test_core_os_exit.odin" (Unix only)
2022-03-24 19:31:46 +00:00
gingerBill
a7adb2fb6e Merge branch 'master' into freestanding_amd64 2022-03-14 11:02:59 +00:00
gingerBill
8e4d6b3e5d Fix typo 2022-03-09 11:24:36 +00:00
gingerBill
ba412fd87b Fix typo 2022-03-09 09:36:21 +00:00
gingerBill
ff60b752bd Replace #if with if where possible 2022-03-08 22:35:10 +00:00
gingerBill
17dab04422 Refactor link flag creation for nix systems 2022-03-08 11:13:59 +00:00
kstrb
1cd89b2da3 Linux: allow 'foreign import' of object files 2022-03-05 17:28:34 +01:00
Sébastien Marie
f76f70c7cf openbsd: defaults to PIE executable
OpenBSD uses PIE code by default to allow the system to load the binary at a random location.

don't pass -no-pie to preserve this behaviour, and build objects with -fPIC (LLVMRelocPIC).
2022-02-28 15:24:22 +00:00
gingerBill
09e4fff5b1 -target-features:<string>
This just passes a string directly to the LLVM features string
2022-02-28 15:08:50 +00:00
gingerBill
278e239973 Commit rest of code for -disallow-rtti 2022-02-28 13:40:01 +00:00
gingerBill
45124e4d5c Merge branch 'master' into freestanding_amd64 2022-02-28 12:32:51 +00:00
gingerBill
c3c88633a5 Merge pull request #1545 from AquaGeneral/master
Added options to help, and improved wording
2022-02-24 10:15:13 +00:00
Jesse Stiller
384fb76a1b Added options to help, and improved wording 2022-02-24 12:59:06 +10:00
gingerBill
196bd735d4 Replace local @(no_red_zone) with global -disable-red-zone 2022-02-23 11:29:36 +00:00
gingerBill
3d209798c9 Add help docs for -reloc-mode:<string> 2022-02-23 11:19:51 +00:00
gingerBill
3e5c60f746 Add -reloc-mode:<string> 2022-02-20 14:48:12 +00:00
gingerBill
0fa487f468 Add -foreign-error-procedures 2022-02-20 14:27:44 +00:00
gingerBill
71df46456a Minimize memory usage by having an arena per thread rather than an arena per file 2022-02-18 21:30:25 +00:00
gingerBill
9e98494fff Merge pull request #1482 from odin-lang/objc-intrinsics
Improve support Objective-C code through intrinsics and Metal API
2022-02-15 15:48:56 +00:00
Phil H
e6e04fc6c8 Add 'odin run -help' info for specifying args 2022-02-14 22:15:55 -08:00
gingerBill
fd8b2e0b88 Merge branch 'master' into objc-intrinsics 2022-02-14 11:04:36 +00:00
gingerBill
441365b388 Set the macOS minimum version to 12 for ARM CPUs 2022-02-14 10:58:01 +00:00
gingerBill
f8afda3b22 Add more objc attributes 2022-02-11 22:54:51 +00:00
oskarnp
c6ed3fa4b5 Fix invalid linker flags passed to clang on macOS 2022-01-14 10:48:41 -05:00
Dale Weiler
ee260986a9 more fixes 2022-01-13 00:19:04 -05:00
gingerBill
3def94505e Add dynamic to error message for -build-mode 2022-01-12 20:28:11 +00:00
gingerBill
e30f16b1f3 Correct -init for *nix 2022-01-12 20:17:30 +00:00
Dale Weiler
4334dbe69a disable this warning 2022-01-10 18:00:38 -05:00
Dale Weiler
8f91e9307c shared library fixes 2022-01-10 17:57:33 -05:00
Wes Hardee
a48317deee use '___$startup_runtime' for MacOS
MacOS needs 3 underscores unlike the 2 needed by Linux.
2021-12-18 12:43:24 -06:00
gingerBill
27106dd9ae Allow .asm, .s, and .S as valid assembly file extensions 2021-11-26 22:25:07 +00:00
gingerBill
ffd7ca57f1 Move nasm.exe to windows/nasm.exe, etc 2021-11-26 14:40:39 +00:00
gingerBill
c34a331696 Add -extra-assembler-flags 2021-11-24 22:20:18 +00:00
gingerBill
994ee5a559 Allow for multiple .asm files 2021-11-24 17:57:31 +00:00
gingerBill
50057b0696 Add basic support for foreign import "foo.asm" on Windows with nasm.exe 2021-11-24 16:56:42 +00:00
DYSEQTA
e5f961b48f Removed '--help' from help string as per request. 2021-11-24 11:10:40 +11:00
cybermancer
1823b0cead Improve compiler help output with regard to command specific help. 2021-11-16 15:15:21 +11:00
gingerBill
1ec0b79345 Allow both -help and --help if passed as init_filename 2021-11-15 22:10:31 +00:00
Jeroen van Rijn
8c5c45a04c [timings-export] Style fixes. 2021-11-10 12:23:46 +01:00
Jeroen van Rijn
9dc8753a14 [timings-export] Improve help messages
Also make `clang` happy as concerns the build settings switch/case.
2021-11-09 22:52:26 +01:00
Jeroen van Rijn
6c306f7633 Fix Linux warnings. 2021-11-09 20:31:22 +01:00
Jeroen van Rijn
05a86d5296 [timings-export] Implement JSON + CSV timngs export. 2021-11-09 19:57:55 +01:00
Jeroen van Rijn
9422fd311f [timings-export] Add -export-timings:format + -export-timings-file:filename. 2021-11-09 19:51:27 +01:00
gingerBill
50562440bf Correct wasm-ld path for non-Windows platforms 2021-11-09 08:09:56 +00:00