13421 Commits

Author SHA1 Message Date
LemonBoy
7c3896e6cd translate-c: Prevent mistranslation of fp literals
When trying to retrieve 80bit fp values from clang using
getValueAsApproximateDouble we'd eventually hit the ceiling value and
return infinity, an invalid value for a fp literal.

Add some logic to prevent this error and warn the user.

Closes #8602
2021-04-24 18:42:23 +02:00
Jakub Konka
4ec6d174ad zld: new approach at handling static inits 2021-04-24 08:13:53 +02:00
Jakub Konka
b00d08b667 zld: add temp debug info fix by setting mtime=0 2021-04-24 08:13:53 +02:00
Jakub Konka
b03983b450 zld: analyze static initializers 2021-04-24 08:13:53 +02:00
Jakub Konka
4f7765de7c zld: common section should be writable 2021-04-24 08:13:53 +02:00
Andrew Kelley
a279f18bce
Merge pull request #8599 from LemonBoy/unsigned-neg
stage1: Allow wrapping negation on unsigned ints at comptime
2021-04-23 16:59:01 -04:00
Hadron67
e86a1df9f2 std.atomic: load should take const pointer to Self 2021-04-23 22:39:49 +02:00
Andrew Kelley
dfb34c3155
Merge pull request #8586 from LemonBoy/ppc32-touchups
A few more PPC32 touch-ups
2021-04-23 15:12:38 -04:00
LemonBoy
9ac5f98200 std: Remove unneeded workaround
Now that -% works on unsigned integers at comptime this (clever) hack is
not not needed anymore.
2021-04-23 19:19:44 +02:00
LemonBoy
cc8e49283d stage1: Allow wrapping negation on unsigned ints at comptime
Closes #7951
Closes #8574
2021-04-23 19:15:52 +02:00
Andrew Kelley
41efdc73b9 langref: add docs for @extern 2021-04-22 16:24:14 -07:00
LemonBoy
6cd71931cb stage1: Unbreak build on FreeBSD
It turns out that the endianness-detection header delivered with the
softfloat library is extremely brittle and gives wrong results when
targeting FreeBSD (long story short, _BIG_ENDIAN is always defined there
and that breaks the #if defined() chain).

Use our own endianness detection header to work around any potential
problem.
2021-04-21 22:07:55 +02:00
LemonBoy
c5cc6b7082 compiler-rt: Export __extendhftf2 and __trunctfhf2
Even though LLVM12 doesn't make use of those intrinsics at the moment
let's export them anyway.
2021-04-21 19:02:13 +02:00
LemonBoy
e0d7cfce5f compiler-rt: Don't re-define PPC builtins in test mode
Prevent linking errors when `zig test`-ing the compiler_rt module for
powerpc-linux triples.
2021-04-21 19:00:57 +02:00
LemonBoy
89d0cc4d8c test: Add 32bit PowerPC to the test plan
Since MIPS is temporarily out of order due to some issues with LLD let's
add PPC32 to have at least one big-endian platform in the testing plan.
2021-04-21 16:31:30 +02:00
LemonBoy
e4f9a3041a std: Use stat definition with 32bit *time fields
We're not ready for Y38K yet.
2021-04-21 16:31:30 +02:00
LemonBoy
d82eb8dd40 std: Split syscall parameters for PowerPC targets 2021-04-21 16:31:29 +02:00
Jakub Konka
c8753aceef macho: fix typos in consts defs 2021-04-21 06:49:34 +02:00
Michael Dusan
0c6dfa6f0c target: drop ppc32 and prefer ppc
- original PR #7949 (incorrectly) patched a generated-file and changes
  have subsequently been lost/overwritten
- fix #7947 in a different way: drop `ppc32` because `ppc` already exists
2021-04-20 16:19:59 -04:00
Frank Denis
10f2d62789
std/crypto: use finer-grained error sets in function signatures (#8558)
std/crypto: use finer-grained error sets in function signatures

Returning the `crypto.Error` error set for all crypto operations
was very convenient to ensure that errors were used consistently,
and to avoid having multiple error names for the same thing.

The flipside is that callers were forced to always handle all
possible errors, even those that could never be returned by a
function.

This PR makes all functions return union sets of the actual errors
they can return.

The error sets themselves are all limited to a single error.

Larger sets are useful for platform-specific APIs, but we don't have
any of these in `std/crypto`, and I couldn't find any meaningful way
to build larger sets.
2021-04-20 19:57:27 +02:00
Andrew Kelley
1e06a74348
Merge pull request #8542 from LemonBoy/floating-point-is-hard-my-dude
Floating point is hard my dude
2021-04-20 13:28:03 -04:00
Veikka Tuominen
2ca26ffde7
Merge pull request #8582 from LemonBoy/more-libc-impl
Improve the libc implementation
2021-04-20 19:54:16 +03:00
Jakub Konka
d64c76e8f1 zld: fix parsing of weak symbols 2021-04-20 16:55:32 +02:00
Jakub Konka
7bc6554a58 zld: map __DATA,__common as __DATA_CONST,__common 2021-04-20 16:55:32 +02:00
Jakub Konka
e5b83056ae zld: resolve symbols as globals before resolving locals 2021-04-20 16:55:32 +02:00
Jakub Konka
8943a0aaaa zld: dedup initializers and finalizers 2021-04-20 16:55:32 +02:00
Jakub Konka
3e73a3c29b zld: treat priv extern as weak symbol 2021-04-20 16:55:32 +02:00
LemonBoy
a5a3ad5e10 c: Minor cleanup
* Remove superfluous "test_" prefix in test names
* Use aliased isNan everywhere
2021-04-20 15:44:54 +02:00
LemonBoy
a4e2539b09 c: Implement fmax and fmaxf 2021-04-20 15:44:21 +02:00
LemonBoy
fcfe25710b c: Implement fmin and fminf 2021-04-20 15:43:46 +02:00
LemonBoy
c7c77fb1b0 c: Add tests for generic_fmod implementation 2021-04-20 15:43:01 +02:00
LemonBoy
be551d85b7 translate-c: Group field access LHS if necessary 2021-04-20 15:16:25 +03:00
Evan Haas
63304a871e translate-c: group LHS of array access if necessary 2021-04-20 11:33:01 +03:00
Evan Haas
55e6bd10fe translate-c: use transCreateNodeInfixOp for pointer arithmetic 2021-04-20 11:33:01 +03:00
Isaac Freund
e2cc02717e Fix .gitattributes rules that should be recursive
These are currently incorrect according to the gitattributes(5) and
gitignore(5) man pages. However, it seems github ended up treating them
as we intended due to a bug until recently when that bug was fixed.
2021-04-19 16:55:12 -04:00
Hubert Jasudowicz
d605f02756 std: Add process_vm_readv/writev wrappers 2021-04-19 16:12:28 +02:00
joachimschmidt557
fbda9991f4 stage2 codegen: Fix silent bug in reuseOperand 2021-04-17 20:57:26 -04:00
Isaac Freund
4081e0a475 zig fmt: bypass auto indentation for // zig fmt: on
Currently an indented `// zig fmt: on` will be indented an additional
time on every run of zig fmt.
2021-04-17 20:10:20 -04:00
Isaac Freund
8e6865c8ee std/build: fix linker_allow_shlib_undefined
The relevant flags were renamed in 01a1365 but updating std.build
was overlooked.
2021-04-17 15:17:54 +02:00
Frank Denis
9f6b56ab4b
Merge pull request #8555 from chivay/pidfd
std: Add pidfd wrappers
2021-04-17 15:03:25 +02:00
jacob gw
afb9f695b1 stage2: add support for zig cc assembler -mcpu option 2021-04-17 02:00:07 -04:00
Hubert Jasudowicz
5134fb72ef std: Add pidfd wrappers 2021-04-17 01:13:16 +02:00
Isaac Freund
01a1365857 Rename --(no-)allow-shilb-undefined to -f(no-)allow-shilb-undefined
This breaks with GNU ld but is consistent with our naming convention for
all the rest of the flags.
2021-04-17 00:03:35 +02:00
daurnimator
99e7ba24b1 Add LibExeObjStep.linker_allow_shlib_undefined field to set --allow-shlib-undefined 2021-04-16 22:51:51 +02:00
daurnimator
0e687d125b Add --(no-)allow-shlib-undefined to supported zig linking flags 2021-04-16 22:51:51 +02:00
Andrew Kelley
140d9df99b
Merge pull request #8506 from LemonBoy/test-c-file
build: Test the c.zig file too
2021-04-16 13:03:52 -04:00
joachimschmidt557
5edabb3990 stage2 register manager: Add functions for allocating multiple registers 2021-04-16 13:03:10 -04:00
Manuel Floruß
2cd49d20e8 Fix std.os.windows.user32.messageBoxW
Arguments to `selectSymbol` were passed in the wrong order.
2021-04-16 13:01:25 -04:00
Andrew Kelley
235aa8c078 ci: drone: don't skip stage2 tests
the stalls seem to be happening for a different reason
2021-04-16 09:57:31 -07:00
Mahdi Khanalizadeh
d1a41feddc linux: fix number of arguments for tgkill syscall 2021-04-16 17:09:15 +02:00