41 Commits

Author SHA1 Message Date
LemonBoy
d44486b274 std: Add libssp implementation for GNU/Windows targets
Unlike glibc and musl, MinGW provides no libssp symbols leading to
countless compile errors if FORTIFY_SOURCE is defined.

Add a (incomplete) implementation of libssp written in Zig so that
linking succeeds.

Closes #6492
2020-10-16 21:22:14 -04:00
LemonBoy
e355bcce36 compiler-rt: Add missing floatdisf routine
Add __floatdisf and __aeabi_l2f

Closes #6188
2020-08-30 00:28:18 -04:00
Andrew Kelley
9cfcd0c296
Merge pull request #6103 from Vexu/extern
Disallow extern variables with initializers.
2020-08-20 18:35:31 -04:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu
d25674a51e
disallow extern variables with initializers 2020-08-20 11:35:33 +03:00
Vexu
1f8f434b9c
compiler_rt: add floatditf 2020-07-29 18:03:44 +03:00
Tadeo Kondrak
f977155fdb
@Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
LemonBoy
ed69821f5b
compiler-rt: Add the __atomic family of builtins
The implementation was checked against a few files using std::atomic and
compiled using zig c++.

Closes #4887
2020-04-03 16:04:44 -04:00
Andrew Kelley
0e372ccff5
clean up the duplicate export logic for __clear_cache 2020-03-31 10:48:48 -04:00
LemonBoy
e9c49f423d
compiler-rt: More clear_cache implementations 2020-03-31 10:36:12 -04:00
Andrew Kelley
83ff94b1cc
compiler-rt: don't export __clear_cache when no impl available 2020-03-30 23:15:07 -04:00
Timon Kruiper
f6f03cd90f compiler-rt: implement clear_cache for arm32-linux 2020-03-31 00:29:41 +02:00
LemonBoy
1ef6f068f5 compiler-rt: Implement all the shift builtins
* Unify all the code paths with a generic function
* Add some EABI aliases

Closes #4853
2020-03-30 10:58:47 -04:00
LemonBoy
cc774c603b compiler-rt: Add __divtf3 2020-03-24 18:08:53 +01:00
Andrew Kelley
03013e5176
compiler-rt: aarch64 implementation of __clear_cache 2020-03-24 10:33:23 -04:00
Andrew Kelley
36aa3c8e7f
fix __stack_chk_guard emitted even when not linking libc 2020-02-28 14:51:55 -05:00
Andrew Kelley
4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
LemonBoy
ea8755fda9 compiler-rt: Export the AEABI builtins when targeting thumb 2020-02-11 15:24:18 +01:00
LemonBoy
69c72e24d4 compiler-rt: Port __mulsi3 builtin 2020-01-22 13:04:45 -05:00
LemonBoy
5fbc1c2812 Nuke some more code 2020-01-19 00:12:27 +01:00
LemonBoy
3247fd7862 Export MSVC builtins inconditionally 2020-01-19 00:12:27 +01:00
LemonBoy
ae31da9334 Minor cleanup 2020-01-19 00:12:26 +01:00
LemonBoy
6b056d1fb9 Nuke some repeated code 2020-01-19 00:12:25 +01:00
Michaël Larouche
d9be6e5dc6 Port clzsi2 from compiler_rt, required for using std.fmt.format on some ARM architecture. 2020-01-17 14:25:22 -05:00
LemonBoy
f609ce4f65 Minor changes to the ARM builtin fns 2020-01-16 12:50:53 -05:00
LemonBoy
c5cfc9bf68 Move definition of __aeabi_read_tp 2020-01-15 17:50:51 +01:00
LemonBoy
109e5f8a5a Remove unnecessary logic 2020-01-15 17:50:51 +01:00
LemonBoy
44e3796285 Rearrange some builtin functions placement 2020-01-15 12:48:28 +01:00
LemonBoy
5ab5de89c0 New @export() handling
Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)

Closes #2679 as it was just a matter of a few lines of code.
2020-01-09 13:43:06 -05:00
Ryan Liptak
834218d789 Fix remaining variadic formatted prints
Used a series of regex searches to try to find as many instances of the old pattern as I could and update them.
2020-01-09 13:36:44 -05:00
LemonBoy
e81b505960 Use the correct calling convention for AEABI intrinsics 2020-01-07 13:42:47 -05:00
LemonBoy
e3a63b4e5a Add more compiler-rt functions for ARM platform 2020-01-06 19:08:15 -05:00
Andrew Kelley
53913acaf7
zig fmt and update extern fn to callconv(.C) 2020-01-06 15:34:50 -05:00
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
LemonBoy
4de3f9d853 Fix stack-probe symbol redefinition 2019-10-10 09:38:57 +02:00
LemonBoy
9ae293ae3b Remove x86/Windows name mangling hack
Let's fix this properly by generating the correct lib files from the
mingw sources.
2019-10-09 22:44:36 +02:00
LemonBoy
a4b3e695af Shuffle around some stack-probing functions 2019-10-09 22:44:35 +02:00
LemonBoy
93a49076f7 Initial support for i386-windows-msvc target 2019-10-06 14:27:36 +02:00
Andrew Kelley
ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00