Commit graph

35 commits

Author SHA1 Message Date
Alex Rønne Petersen
a82f446d91
std.elf: change STV enum from u2 to u3
In gABI 4.3, st_other was changed such that the lower 3 bits are reserved for
the visibility, up from the previous 2 bits.
2025-09-04 01:16:23 +02:00
Andrew Kelley
9adcc31ca3 update tools and other miscellaneous things to new APIs 2025-08-30 00:48:50 -07:00
Andrew Kelley
f1576ef14c objcopy: delete most of it
this code is not up to zig project standards

tracked by #24522

oh, and fix not adjusting buffer seek position in std.fs.File.Reader
2025-07-21 12:32:37 -07:00
Alex Rønne Petersen
2ffa63acef
tools: fix some bitrot 2025-07-16 06:37:48 +02:00
Andrew Kelley
d8e26275f2 update standalone and incremental tests to new API 2025-07-07 22:43:53 -07:00
Alex Rønne Petersen
30200edc1e
gen_stubs: Add hexagon-linux-musl support. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
fc8a4c445d
gen_stubs: Require less manual intervention and produce better output.
The tool will now skip over undefined symbols. These can only occur as a result
of building musl without compiler-rt, i.e. -rtlib=none. Thanks to this, it's no
longer necessary to patch Zig's compiler-rt, nor is it necessary to maintain a
symbol blacklist.

See the updated instructions here: https://github.com/ziglang/zig/wiki/Updating-libc#updating-the-libcs-file

Additionally, the tool now produces slightly more compact output by recognizing
symbols that are defined for a single arch, for a family of arches, or only for
arches using 32-bit or 64-bit time as their primary ABI.

Finally, the tool now supports all architectures that we can emit code for, with
the single exception of x86_64-linux-muslx32. (x32 currently fails with a ton of
relocation errors, leading me to believe that it might be an LLVM or LLD bug.)
2024-11-23 03:10:58 +01:00
YANG Xudong
ea847535fc Add loongarch 64 to gen_stubs.zig. 2024-08-04 12:04:39 -07:00
Alex Rønne Petersen
e0b9ebf322
gen_stubs: Add riscv32 handling in a few more places. 2024-07-29 09:50:41 +02:00
Andrew Kelley
46b2f67905 update musl libc.S to v1.2.5
adds loongarch64 and riscv32
2024-06-04 22:37:28 -07:00
Andrew Kelley
3fc6fc6812 std.builtin.Endian: make the tags lower case
Let's take this breaking change opportunity to fix the style of this
enum.
2023-10-31 21:37:35 -04:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Andrew Kelley
09c7f1bd7c musl: update libc.S to v1.2.4 2023-06-20 12:55:38 -04:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Jan Philipp Hafer
f043071cdf compiler_rt: add missing PPC routines
Adds conditional exports
- __fixkfti
- __fixunskfti
- __floattikf
- __negkf2
- __mulkc3
- __divkc3
- __powikf2
and adjusts tools/gen_stubs.zig.

From https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html:
"When long double transitions to __float128 on PowerPC in the future,
__ibm128 will remain for use in conversions between the two types."

Hence `__extendkftf2` and `__trunctfkf2` for conversion are superfluous
and only using f128 for `kf` routines is justified.

Closes #16057.
2023-06-16 23:37:50 -07:00
Ali Chraghi
3db3cf7790 std.sort: add pdqsort and heapsort 2023-05-23 17:55:59 -07:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Jan Philipp Hafer
e10c0eefde compiler_rt: add __powihf2, __powisf2, __powidf2, __powitf2, __powixf2
Implementation and tests ported from LLVM release 80.
Tests of __powihf2 created from __powisf2 tests with minor adjustments.
2023-02-12 00:10:27 +02:00
matu3ba
d976b4e4a5
compiler_rt: __divmodti4 for libgcc symbol compatibility
- Copy and adjust __divmodsi4 tests for __divmoddi4 and __divmodti4.
- Assuming d = a/b does not overflow (MIN/-1) or uses div by 0,
  then tmp = (d * b) = (a/b * b) = a does not overflow.
  => Remove wraparound for remainder in applicable routines.
2023-02-11 14:41:08 +02:00
matu3ba
1bda8be2a3
compiler_rt: __ashlsi3, __ashrsi3, __lshrsi3 for symbol compatibility
These are unused in LLVM, but in gcc used for example by rl78.
Move test files into common file, add tests for aforementioned routines
and missing ones for __lshrti3.
2023-02-11 14:25:01 +02:00
Jan Philipp Hafer
301a89849b tools: build all tools in ci to prevent bitrot
No LLVM assertions were triggered for me.
Closes #12015
Closes #12022
Closes #12223
2023-01-06 01:18:46 +02:00
Frank Denis
8d66aacb64
compiler-rt: implement __udivei4 and __umodei4 (#14023)
Allows dividing and formatting arbitrary-large unsigned integers.
2022-12-22 16:29:19 -05:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Veikka Tuominen
62ff8871ed stage2+stage1: remove type parameter from bit builtins
Closes #12529
Closes #12511
Closes #6835
2022-08-22 11:19:20 +03:00
Isaac Freund
2477a95d29
tools/gen_stubs: sort output by section/symbol name
This will make future diffs smaller and easier to review.
2022-05-04 18:38:45 +02:00
Isaac Freund
f4131cf8a6
musl: update to 1.2.3
This was a bit trickier than it should be due to symbol conflicts with
zig's compiler-rt implementation. We attempt to use weak linkage in
our compiler-rt, but this does not seem to be working in all cases. I
manually disabled export of the problematic compiler-rt math functions
in order to cross compile musl's libc.so for all targets as input to
`tools/gen_stubs.zig`.

Other than that, this update went fairly smoothly. Quite a few
additional symbols were added to the blacklist in `tools/gen_stubs.zig`
due to recent reorganization of zig's compiler-rt.
2022-05-04 01:00:57 +02:00
Andrew Kelley
da9542c0af tools/gen_stubs: add aarch64 and output preprocessor directives
Now it outputs libc.S which can be assembled with zig, and the small
differences per-architecture are handled with preprocessor directives.

There is also now a set of blacklisted symbols which contains
compiler-rt.
2021-12-09 01:21:30 -07:00
Andrew Kelley
04d44db6cc tools/gen_stubs: consolidate symbol properties into MultiSym 2021-12-08 23:45:25 -07:00
Andrew Kelley
808b9239a3 improve musl dynamic stubs file libc.s
tools/gen_stubs.zig now cuts out the middle man and operates directly on
the libc.so ELF file. it outputs accurate .size directives for objects.

std.elf gains an STV enum.
2021-12-08 22:32:31 -07:00
Lee Cannon
1093b09a98
allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
Lee Cannon
75548b50ff
allocgate: stage 1 and 2 building 2021-11-30 23:32:47 +00:00
Andrew Kelley
4d75382452 tools/gen_stubs.zig: better error message on invalid input 2021-11-08 15:31:14 -07:00
Julian Maingot
384ccaa27a stage2: use %type not @type for libc stubs
Missed a couple places last time so just doing the rest.
2021-01-18 11:04:33 -08:00
Isaac Freund
343249efd8 stage2: use %type not @type for libc stubs
Apparently ARM uses @ for comments. Everything seems to accept % here
though.
2020-12-13 23:19:23 -05:00
Isaac Freund
307d98dc35
stage2: support dynamically linking musl libc 2020-12-13 00:40:35 +01:00