608 Commits

Author SHA1 Message Date
Andrew Kelley
c15e464320
Merge branch 'uefi' of https://github.com/nrdmn/zig into nrdmn-uefi 2019-09-13 14:10:42 -04:00
LemonBoy
774f770056 Correct AT_FDCWD definition 2019-09-12 13:15:50 -04:00
Andrew Kelley
cf4bccf765
improvements targeted at improving async functions
* Reuse bytes of async function frames when non-async functions
   make `noasync` calls. This prevents explosive stack growth.
 * Zig now passes a stack size argument to the linker when linking ELF
   binaries. Linux ignores this value, but it is available as a program
   header called GNU_STACK. I prototyped some code that memory maps
   extra space to the stack using this program header, but there was
   still a problem when accessing stack memory very far down. Stack
   probing is needed or not working or something. I also prototyped
   using `@newStackCall` to call main and that does work around the
   issue but it also brings its own issues. That code is commented out
   for now in std/special/start.zig. I'm on a plane with no Internet,
   but I plan to consult with the musl community for advice when I get a
   chance.
 * Added `noasync` to a bunch of function calls in std.debug. It's very
   messy but it's a workaround that makes stack traces functional with
   evented I/O enabled. Eventually these will be cleaned up as the root
   bugs are found and fixed. Programs built in blocking mode are
   unaffected.
 * Lowered the default stack size of std.io.InStream (for the async
   version) to 1 MiB instead of 4. Until we figure out how to get
   choosing a stack size working (see 2nd bullet point above), 4 MiB
   tends to cause segfaults due to stack size running out, or usage of
   stack memory too far apart, or something like that.
 * Default thread stack size is bumped from 8 MiB to 16 to match the
   size we give for the main thread. It's planned to eventually remove
   this hard coded value and have Zig able to determine this value
   during semantic analysis, with call graph analysis and function
   pointer annotations and extern function annotations.
2019-09-12 01:40:58 -04:00
LemonBoy
fec795cd29 Adjust the stdlib to be 32bit compatible 2019-09-09 16:16:13 -04:00
LemonBoy
e4c3067617 Fix typo in TLS initialization code 2019-09-09 13:54:31 -04:00
Andrew Kelley
a7fd14096c
fix typo with tls initialization
I tested that hello world cross compiles to armv7 now.

closes #3167
2019-09-04 14:44:16 -04:00
Robin Voetter
df06976e73 Only check for TLS support on arm if TLS segment exists 2019-09-04 17:48:01 +02:00
Robin Voetter
77d04c03e3 Implement remaining requested changes
- Replace @intCast with a checked version (std/debug.zig)
- Replace @intCast with i64() when casting from a smaller type (std/fs/file.zig)
- Replace `nakedcc` with appropriate calling convention for linking with c (std/os/linux/arm-eabi.zig)
- Only check if hwcap contains TLS when the hwcap field actually exists (std/os/linux/tls.zig)
2019-09-04 16:23:25 +02:00
Robin Voetter
6a76298740 Add missing clobbers on arm-eabi and arm64 syscall conventions 2019-09-04 15:59:51 +02:00
Nick Erdmann
5e874a89b9
std/os/uefi: fix ordering of packed bit fields 2019-09-02 22:31:59 +02:00
Nick Erdmann
8db41b7adb
std/os/uefi: add support for getting memory map 2019-09-02 22:10:50 +02:00
Nick Erdmann
03abc6edf4
std/os/uefi: add global_variable guid 2019-09-02 20:34:00 +02:00
Robin Voetter
d62f7c6b60 Merge remote-tracking branch 'upstream/master' into arm-support-improvement 2019-09-01 23:45:51 +02:00
Robin Voetter
e7912dee9b Fix up preadv, preadv2, pwritev and pwritev2 2019-09-01 16:10:36 +02:00
Robin Voetter
e9d795b025 Fix up seteuid and setegid 2019-09-01 12:08:02 +02:00
Robin Voetter
e39c93a2f3 Replace legacy 16-bit syscalls with 32-bit versions when appropriate 2019-09-01 11:54:57 +02:00
Andrew Kelley
8b1900e5df
Revert "Merge pull request #2991 from emekoi/mingw-ci"
This reverts commit ec7d7a5b14540ea3b2bab9f11318630338467965, reversing
changes made to 81c441f8855d4c58f0b2ff86d3d007cf0bf395d3.

It looks like this broke colors in Windows Command Prompt (#3147)
and this method of detecting native C ABI isn't working well (#3121).
2019-09-01 00:33:02 -04:00
Robin Voetter
4b8325f381 Remove unneeded os check 2019-08-30 13:02:15 +02:00
Robin Voetter
c1f8b201a1 Improve comments near un-implemented functionality 2019-08-30 12:58:44 +02:00
Robin Voetter
2323da3a68 add __aeabi_read_tp 2019-08-29 18:12:58 +02:00
Robin Voetter
108a51b110 fix issues with debug.zig
- Use sys_*stat*64 instead of sys_*stat* where appropriate
- Fix overflow when calculating atime, ctime and mtime on File.stat()
- Fix compilation error casting getEndPos to usize.
2019-08-29 10:34:05 +02:00
Robin Voetter
b3ac323a44 TLS initialization, clone definition and _start functionality 2019-08-29 01:14:43 +02:00
Robin Voetter
57de61084e Make mmap use SYS_mmap2 if it exists 2019-08-29 00:55:22 +02:00
Robin Voetter
223b773e03 Add more syscall constants 2019-08-29 00:54:57 +02:00
Robin Voetter
50c37c75d1 add arm32 syscall conventions 2019-08-28 17:41:49 +02:00
Robin Voetter
32f4606cec add arm32 linux bits definitions 2019-08-28 16:35:23 +02:00
Andrew Kelley
ec7d7a5b14
Merge pull request #2991 from emekoi/mingw-ci
mingw improvements
2019-08-21 12:29:42 -04:00
Andrew Kelley
3dce41b61a
improvements to std lib for event-based I/O 2019-08-16 21:29:29 -04:00
Andrew Kelley
7e75e1075e
zig fmt 2019-08-15 18:19:04 -04:00
Nick Erdmann
70e62b8612
std/os/uefi: some more events 2019-08-11 15:50:03 +02:00
Nick Erdmann
47ce736abe
std/os/uefi: add basic Event support 2019-08-10 19:14:47 +02:00
Nick Erdmann
9445b3f057
std/os/uefi: change type of Handle from @OpaqueType to *@OpaqueType 2019-08-10 19:14:31 +02:00
Euan Torano
f2bef0447a
Remove unneeded casts. 2019-08-07 22:19:25 +01:00
Euan Torano
2d25348f63
Fix function signature and use a loop to ensure buffer is filled. 2019-08-06 19:32:22 +01:00
Nick Erdmann
88fdb303ff
std/os/uefi: replace init() with default values 2019-08-06 18:06:18 +02:00
Nick Erdmann
20ce0b9952
std/os/uefi: replace integer bit fields with packed structs 2019-08-05 18:26:13 +02:00
Euan T
8aa87ec441 Add misisng newline 2019-08-05 09:23:15 -07:00
Euan Torano
0157365872 Add missing S_IS* for NetBSD 2019-08-05 09:23:15 -07:00
Nick Erdmann
b979fc1bcd
initial work torwards std lib support for uefi 2019-08-04 21:53:49 +02:00
emekoi
59e2c87b4b move windows abi detection to get_native_target 2019-08-03 18:40:27 -05:00
emekoi
102d3f30c4 accept unix style paths on windows-gnu 2019-08-02 19:39:33 -05:00
Euan Torano
24fbd1f1d5 Add S_* values for freebsd. 2019-08-02 16:05:03 +01:00
Euan Torano
1583efda69 Fix call to S_ISCHR and implement for Mac 2019-08-02 15:55:56 +01:00
Andrew Kelley
bc31c1280e
disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:41:59 -04:00
Andrew Kelley
eaf545e24c fix build on windows 2019-07-15 19:50:56 -04:00
Andrew Kelley
49d1a4c562 move lib dirs to lib subdir
also start prefering NtDll API. so far:
 * NtQueryInformationFile
 * NtClose

adds a performance workaround for windows unicode conversion. but that
should probably be removed before merging
2019-07-15 17:54:50 -04:00
Andrew Kelley
51a3938b04 fix the build on macos
Stat structs gain methods to abstract over the platform differences with
regards to mtime, ctime, atime.
2019-07-15 12:28:39 -04:00
Andrew Kelley
b23ace27db
fix the build on windows 2019-07-15 01:45:26 -04:00
Andrew Kelley
aa170a7eff
implement std.fs.File.updateTimes for windows 2019-07-15 01:45:26 -04:00
Andrew Kelley
6096dc5f94
move some of the installation from cmake to zig build
This moves the installation of shipped source files from large
CMakeLists.txt lists to zig build recursive directory installation.

On my computer a cmake `make install` takes 2.4 seconds even when it has
to do nothing, and prints a lot of unnecessary lines to stdout that say
"up-to-date: [some file it is installing]".

After this commit, the default output of `make` is down to 1
second, and it does not print any junk to stdout. Further, a `make
install` is no longer required and `make` is sufficient.

This closes #2874.

It also closes #2585. `make` now always invokes `zig build` for
installing files and libuserland.a, and zig's own caching system makes
that go fast.
2019-07-15 01:45:26 -04:00