Commit Graph

13540 Commits

Author SHA1 Message Date
Veikka Tuominen
0a38f61d58 update usage of std.testing in behavior and standalone tests 2021-05-08 15:15:30 +03:00
Veikka Tuominen
fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
Veikka Tuominen
59f9253d94 allow tests to fail 2021-05-08 15:15:23 +03:00
Andrew Kelley
530e67cb86
Merge pull request #8683 from LemonBoy/thumblinux
Initial bringup for Linux/Thumb2
2021-05-06 12:50:34 -04:00
lars
96e593145d stage1: improve message for missing fn return type
Coming from other languages it might be tempting for programmers to
accidentally leave out the return type instead of returning 'void'.

The error for this used to be

    error: invalid token: '{'
    pub fn main() {
                  ^

which is misleading. The '{' is expected but only after a return type.

The new message is

    error: expected return type (use 'void' to return nothing), found: '{'
    pub fn main() {
                  ^

which not only points out the real error but also hints at a (probably)
very common case where someone coming from e.g. Go is used to not
specifying a return type if a function returns nothing and thus forgets
to put 'void' there.

It might seem overkill to hint at the 'void' option but then the
compiler error messages are our user interface to the programmer. We
can be better than other languages in our error messages and leaving
out the return type seems to be a rather clear indication of the above
mentioned issue. Adding this will help more than distract.
2021-05-06 18:44:10 +02:00
Jakub Konka
88d40fc005 zld: sort tlv offsets by source address 2021-05-06 17:10:05 +02:00
Jakub Konka
ef8a666797 zld: cleanup relocs and flag errors on unhandled symbol types 2021-05-06 17:09:58 +02:00
Jakub Konka
ad33e34836 tests: re-enable reduce behavior tests for wasm32 2021-05-05 21:26:50 +02:00
LemonBoy
9d409233b2 std: Implement hex float printing
The results have been cross-checked with LLVM's APFloat implementation
by randomly sampling the f32/f64 space, while the f16 one was completely
checked given the small size.
2021-05-05 12:37:40 -04:00
LemonBoy
18b46485bc stage2: Fix UAF in ErrorMsg destructor
After calling gpa.destroy the object is gone for good, setting the
contents to undefined is a bug and may crash the compiler.
2021-05-05 12:37:04 -04:00
Michael Dusan
622a3ac876
Merge pull request #8691 from lithdew/master
x/net: fix tcp tests for openbsd and add missing `fmt` import
2021-05-05 05:54:47 -04:00
Andrew Kelley
368e13a9a1
Merge pull request #8671 from LemonBoy/arm-host-det
ARM/AArch64 CPU host detection
2021-05-05 03:17:32 -04:00
LemonBoy
e863204c47 zig fmt: Fix edge case in inline asm parsing
The presence of a trailing comma in the single and only input/output
declaration confused the parser and made zig fmt discard any element
placed after the comma.
2021-05-05 03:16:07 -04:00
Jay Petacat
70a9a3a562 stage1: Fix other OS target
PR #7827 added some new `std.Target.Os.Tag` before `other`.
The corresponding enum in stage1.h was not updated, which caused a
mismatch in the underlying integer values. While attempting to target
`other`, I encountered crashes.

This PR updates the stage1.h enum to include the added OS tags.
The new tags also had to be added to various switch cases to fix
compiler warnings, but have not been tested in any way.
2021-05-05 03:15:44 -04:00
lithdew
c75ae8b66d x/net: fix tcp tests for openbsd and add missing fmt import
On OpenBSD, connecting to a newly-allocated port on an unspecified IPv4
host address causes EINVAL. This was found by @mikdusan when running TCP
tests on OpenBSD.

This commit fixes TCP tests on OpenBSD by having all tests that allocate
a new host-port pair to have the host IPv4/IPv6 address point to the
host's loopback adapter (on localhost).
2021-05-05 16:09:08 +09:00
Andrew Kelley
785a6c1aa9 std: remove dead and rotting C parsing code 2021-05-04 10:26:44 -07:00
LemonBoy
afbcb6209d std: Initial bringup for Linux on Thumb2
There are some small problems here and there, mostly due to the pointers
having the lsb set and disrupting the fn alignment tests and the
`@FrameSize` implementation.
2021-05-04 18:52:53 +02:00
LemonBoy
4bf093f1a0 compiler-rt: Better selection of __clzsi implementation
To be honest all this detection logic is starting to become a real PITA,
the ARM32 version can be possibly removed as the generic version
optimizes pretty well...
2021-05-04 18:45:52 +02:00
LemonBoy
389d1177a5 stage1: Fix LLVM error in inline asm invocation
Pointer types need an extra indirection layer during the generation of
the function prototype for inline asm blocks.

Closes #3606
2021-05-04 18:43:31 +02:00
Jakub Konka
96556ce8b8 zld: port over a few more bits from ld64
* UTF16 gets its own section, `__TEXT,__ustring`
* TLV data and bss sections have to aligned to the same max alignment
  according to Apple rdar comment in the latest ld64
2021-05-04 13:09:32 +02:00
Jakub Konka
1867c3c34c zld: disable most logs 2021-05-04 13:09:32 +02:00
Jakub Konka
9e11f27c41 zld: build updated macho backend 2021-05-04 13:09:32 +02:00
Jakub Konka
00c3d57a51 zld: rewrite symbol allocations 2021-05-04 13:09:32 +02:00
Jakub Konka
fcd57f0857 zld: resolve GOT loads and stubs 2021-05-04 13:09:32 +02:00
Jakub Konka
68ebc7cba0 zld: rewrite symbol resolution 2021-05-04 13:09:32 +02:00
Jakub Konka
86ab6ca56c zld: rewrite Object to include pointers to Symbols 2021-05-04 13:09:32 +02:00
LemonBoy
b6be28ddcc std: Accept unaligned slice in several ArrayListAligned ops
Do not impose the internal alignment requirements to the user-supplied
parameters.

Closes #8647
2021-05-04 14:08:19 +03:00
Andrew Kelley
0e3930bb5a
Merge pull request #8649 from lithdew/master
x/os, x/net: layout tcp, ipv4/ipv6, and socket abstractions
2021-05-03 17:38:10 -04:00
Andrew Kelley
5622f9382c
Merge pull request #8657 from jedisct1/ci-split
Azure CI: Test std.* and the rest separately
2021-05-03 17:36:51 -04:00
LemonBoy
3eed613407 std: Add two more ARM CPUs to the known CPU list
Modeled after GCC's description.
2021-05-03 12:32:13 +02:00
LemonBoy
e2d2295382 std: Add many more vendors and cpus to the ARM detection list
Hand-picked from GCC and LLVM lists.
2021-05-03 12:32:13 +02:00
LemonBoy
a7f3e12d23 std: Add fallback on pre-v6 ARM targets
Thanks xackus for noticing the missing else branch.
2021-05-03 12:32:13 +02:00
LemonBoy
792cf925ec std: Fix missing CPU feature check
We need both the v6k and the v6m checks.
2021-05-03 12:32:13 +02:00
LemonBoy
b10d40b89b stage2: Implement CPU host detection for ARM/AArch64 targets 2021-05-03 12:32:13 +02:00
Frank Denis
97779442d0
Prepare std/crypto/pcurves for ecdsa and other curves (#8670)
Functions generated by Fiat-crypto are not prefixed by their description any more. This matches an upstream change.

We can now use a single type for different curves and implementations.

The field type is now generic, so we can properly handle the base field and scalars without code duplication.
2021-05-03 09:57:45 +02:00
lithdew
96fe49ef62 std/os/bits/windows: add timeval extern struct 2021-05-03 14:49:10 +09:00
lithdew
16fc1b904c std/os/linux/bits: correct socket option codes for ppc/ppc64 2021-05-03 14:49:10 +09:00
lithdew
af057c888b x/net/ip: add copyright header 2021-05-03 14:49:10 +09:00
lithdew
5c4fbc4014 x/net: generalize tcp.Address into ip.Address
Generalize `tcp.Address` into `ip.Address` given that multiple transport
protocols apart from TCP (i.e. UDP) operate solely over IP.
2021-05-03 14:49:10 +09:00
lithdew
cc6714a929 std/os/bits: add timeval struct for riscv64 linux 2021-05-03 14:49:10 +09:00
lithdew
a799ad05b3 x/net/tcp: make tcp tests blocking to avoid unit test races 2021-05-03 14:49:10 +09:00
lithdew
aa15699269 x/os/net: skip ipv6 scope id parse test on unsupported platforms 2021-05-03 14:49:10 +09:00
lithdew
9a7c57144d x/net: disable tcp tests on wasi 2021-05-03 14:49:10 +09:00
lithdew
8ef9d98e6d x/os: fix compile errors on mac and linux
Use i32 instead of isize for os.timeval's for socket read/write
timeouts.

Add a comptime check to resolveScopeID to see if `IFNAMESIZE` is
available on the host. If it is not available, return an error
indicating that resolving the scope ID of a IPv6 address is not yet
supported on the host platform.
2021-05-03 14:49:10 +09:00
lithdew
76304a36af std/builtin: add missing comma to CallingConvention 2021-05-03 14:49:10 +09:00
lithdew
13068da43e x/os, x/net: re-approach Address, rename namespace TCP -> tcp
Address comments from @ifreund and @MasterQ32 to address unsafeness and
ergonomics of the `Address` API.

Rename the `TCP` namespace to `tcp` as it does not contain any
top-level fields.

Fix missing reference to `sockaddr` which was identified by @kprotty in
os/bits/linux/arm64.zig.
2021-05-03 14:49:10 +09:00
lithdew
2ab588049e x/os, x/net: layout tcp, ipv4/ipv6, and socket abstractions
The `Socket` abstraction was refactored to only comprise of methods that
can be generically used/applied to all socket domains and protocols.

A more comprehensive IPv4/IPv6 module derived from @LemonBoy's earlier
work was implemented under `std.x.os.IPv4` and `std.x.os.IPv6`. Using
this module, one can then combine them together into a union for example
in order to optimize memory usage when dealing with socket addresses.

A `TCP.Client` and `TCP.Listener` abstraction is introduced that is one
layer over the `Socket` abstraction, which isolates methods that can
only be applied to a "client socket" and a "listening socket". All prior
tests from the `Socket` abstraction, which all previously operated
assuming the socket is operating via. TCP/IP, were moved. All TCP socket
options were also moved into the `TCP.Client` and `TCP.Listener`
abstractions respectively away from the `Socket` abstraction.

Some additional socket options from @LemonBoy's prior PR for Darwin were
also moved in (i.e. SIGNOPIPE).
2021-05-03 14:49:10 +09:00
Luna
c47028cd02 ci: freebsd: use py38-s3cmd 2021-05-02 17:24:17 -04:00
Frank Denis
9a637f81e0 Restore the CI logging as before 2021-05-02 02:07:59 +02:00
Andrew Kelley
4f9c928e56
Merge pull request #8665 from LemonBoy/misc
Miscellaneous patches
2021-05-01 18:07:58 -04:00