Commit Graph

203 Commits

Author SHA1 Message Date
Jeroen van Rijn
a5342a0126 Address edge cases. 2022-04-26 13:14:09 +02:00
Jeroen van Rijn
f4723aea4c Remove redundant bit for non-Windows. 2022-04-24 13:37:26 +02:00
Jeroen van Rijn
76d48b38d3 Compiler: Allow -out: to not have an extension on *nix for executables (only). 2022-04-24 13:37:26 +02:00
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
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
gingerBill
a7adb2fb6e Merge branch 'master' into freestanding_amd64 2022-03-14 11:02:59 +00:00
Sébastien Marie
499c657ffa rename architecture from 386 to i386 2022-03-03 15:28:18 +00:00
gingerBill
15d783e920 Enforce -no-entry-point on freestanding targets 2022-02-28 15:13:41 +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
882116e358 Only allow -disallow-rtti on freestanding targets 2022-02-28 14:00:44 +00:00
gingerBill
278e239973 Commit rest of code for -disallow-rtti 2022-02-28 13:40:01 +00:00
Sébastien Marie
8e270d3a99 openbsd: poor man implementation for getting executable path
it tries to get executable path from argv[0]. it is unreliable and unsecure, but should be fine enough for the considered use-case. it still doesn't address all possible cases.
2022-02-26 08:19:41 +00:00
Sébastien Marie
ae5cb09041 internal_odin_root_dir: readlink could fail 2022-02-25 17:59:57 +00:00
Sébastien Marie
5676c9e7eb initial OpenBSD support 2022-02-25 08:49:25 +00:00
gingerBill
4a04a32e0a Change target name to freestanding_amd64_sysv 2022-02-23 11:33:28 +00: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
1bec9e5331 Add freestanding_amd64_gnu 2022-02-20 14:19:52 +00:00
gingerBill
070b450768 Add ODIN_ERROR_POS_STYLE constant and change runtime.print_caller_location based on that constant 2022-01-26 17:34:39 +00:00
gingerBill
74174eb4ae Remove spurious ) 2022-01-26 16:38:12 +00:00
gingerBill
081a5a52a6 Add ODIN_ERROR_POS_STYLE environment variable
Allowing for two different error message styles:
default or odin
    path(line:column) message
unix
    path:line:column: message
2022-01-26 16:09:22 +00:00
gingerBill
f0529535e0 ODIN_ENDIAN changed to an enum constant; ODIN_ENUM_STRING is the new string version of the old constant 2022-01-15 17:53:18 +00:00
gingerBill
29ebe0c3c9 Rename architecture 386 to i386 2022-01-15 17:40:00 +00:00
gingerBill
6c48670819 Make ODIN_BUILD_MODE a enum type 2022-01-15 17:34:35 +00:00
gingerBill
847b05013f Disable DEFAULT_TO_THREADED_CHECKER until race condition is found 2022-01-11 10:56:07 +00:00
Yawning Angel
dce120258f src: Add preliminary support for Linux AArch64
Tested via `tests/core`, on a Raspberry Pi 4 running the latest
64-bit Raspberry Pi OS image (LLVM 11).
2021-12-23 02:46:32 +00:00
gingerBill
27106dd9ae Allow .asm, .s, and .S as valid assembly file extensions 2021-11-26 22:25:07 +00:00
gingerBill
c34a331696 Add -extra-assembler-flags 2021-11-24 22:20:18 +00:00
Jeroen van Rijn
9422fd311f [timings-export] Add -export-timings:format + -export-timings-file:filename. 2021-11-09 19:51:27 +01:00
gingerBill
23f0fbc376 Improve matrix->matrix casting implementation 2021-11-08 11:40:41 +00:00
gingerBill
6646348e1a Increase usage of PtrMap 2021-11-05 17:03:02 +00:00
gingerBill
b2a2aa15c2 Add ODIN_BUILD_MODE 2021-11-04 12:49:39 +00:00
gingerBill
c5cd97dd89 Improve wasm-import semantics to allow procedures from different import paths 2021-11-02 12:54:23 +00:00
gingerBill
efe05b3e13 Merge pull request #1252 from Kelimion/bug-report
Add new `odin report` command.
2021-10-31 19:19:56 +00:00
gingerBill
bfa33bf5d3 Disable wasm64 2021-10-31 15:48:56 +00:00
gingerBill
235dae552a Ignore -use-separate-modules when targeting wasm32/wasm64 2021-10-31 15:35:09 +00:00
Jeroen van Rijn
2a7937e2ba Add odin report command to help with bug reports.
Add new Odin command, `odin report`, which prints information helpful to resolving or reporting a bug.

```
W:\Odin> odin report

Where to find more information and get into contact when you encounter a bug:

	Website: https://odin-lang.org
	GitHub:  https://github.com/odin-lang/Odin/issues

Useful information to add to a bug report:

	Odin: dev-2021-10:256bebfe
	OS:   Windows 10 Professional (version: 20H2), build 19042.1266
	CPU:  AMD Ryzen 7 1800X Eight-Core Processor
	RAM:  65469 MiB

W:\Odin>

TODO:
- CPU name on ARM/ARM64
```
2021-10-31 13:48:13 +01:00
gingerBill
2a5b8f53fe Add memmove and memset support for wasm 2021-10-31 12:47:50 +00:00
gingerBill
9a5216921c Add wasi_wasm32 2021-10-31 01:08:17 +00:00
gingerBill
841a96691b Attempt to get wasm64 compiling with the correct features enabled 2021-10-31 00:37:37 +01:00
gingerBill
8ef6f9dd7b Compile wasm64; Add lb_run_remove_unused_function_pass 2021-10-31 00:11:38 +01:00
gingerBill
5bc8a491a7 Begin work on supporting wasm64; Correct wasm32 compilation behaviour 2021-10-30 23:24:34 +01:00
gingerBill
2ad6aa7886 Copying file contents rather than memory mapping 2021-10-12 11:06:39 +01:00
gingerBill
e65e0b5db2 Add -strict-style-init-only 2021-09-09 11:06:19 +01:00
gingerBill
cd09068e33 Correct parsing rules for #assert directives for semicolons 2021-08-31 22:45:08 +01:00
gingerBill
1fff96e088 Make -insert-semicolon the default now 2021-08-31 21:13:53 +01:00
gingerBill
582559f7ac Correct did you mean logic and make thread-safe-er 2021-08-27 11:18:38 +01:00
gingerBill
3e4d615983 Minor fixes 2021-08-26 15:41:32 +01:00