Skip to content

32bit glibc fixes#8705

Merged
andrewrk merged 10 commits intoziglang:masterfrom
LemonBoy:libc-fix
May 11, 2021
Merged

32bit glibc fixes#8705
andrewrk merged 10 commits intoziglang:masterfrom
LemonBoy:libc-fix

Conversation

@LemonBoy
Copy link
Copy Markdown
Contributor

@LemonBoy LemonBoy commented May 7, 2021

This change allows our test suite (at least the parts I've tested) to successfully run on 32bit targets linked w/ glibc.

@LemonBoy LemonBoy force-pushed the libc-fix branch 2 times, most recently from e6fa7d1 to 5b2ab89 Compare May 7, 2021 17:53
@LemonBoy LemonBoy force-pushed the libc-fix branch 3 times, most recently from eb027db to 15c5aeb Compare May 11, 2021 07:37
LemonBoy added 9 commits May 11, 2021 12:33
This change was cherry-picked from an updated version of the sysdep
folder contents, we're still shipping an outdated and incomplete set of
files.
While musl decided to hard-wire off_t to a 64bit quantity, glibc is much
older and defaults to 32bit offsets and offers some -64 suffixed
versions of I/O functions.

There's a weird mix-up of types: sometimes off_t is used, sometimes not,
sometimes it's defined as a signed quantity and sometimes as an unsigned
one, but we'll sort this problem later.
They return c_int and not isize.
This is needed to catch any possible problem with executables linking to
32bit glibc.
Let's follow the libc/kernel convention and use an i64 for offsets, we
bitcast as needed and avoid the useless conditional casts.
It turns out that nothing in the test suite was exercising
preadv/pwritev and so the previous commits silently broke them.

Adding tests revealed readvAll and preadvAll were also broken and not
covered by any test.
Use the same order as Clang (and, by extension, GCC) for the three most
important libc components: lm comes first, followed by lpthread and then
lc.
The kernel interface expects the offset as a low+high pair even on BE
systems.
@andrewrk andrewrk merged commit ace5714 into ziglang:master May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants