[COMMIT osv master] libc: add aliases __isoc23_*

1 view
Skip to first unread message

Commit Bot

unread,
Mar 17, 2024, 7:26:48 AMMar 17
to osv...@googlegroups.com, Nadav Har'El
From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

libc: add aliases __isoc23_*

The C23 standard decided that 50 years of tradition CAN be messed with,
and the language and all its parsing functions should start accepting
binary constants that look like "0b...". Since glibc wants to support
compilation on both C23 and older compilers, it split the parsing functions
like strtoul() to two - the classic one that doesn't support "0b...", and
a new one __iso23_stroul() which gets used on C23 compilers.

On modern systems, the C++ standard library (libstdc++.a) gets compiled
on a modern compiler supporting C23 and modern header files which support
it. Ideally, the C++ standard library would be compiled by C++, which is
NOT C23, so would not end up using __iso23_strtoul(), but it turns out
that it actually does. On such a system OSv build fails the linking
stage, because __iso23_strtoul() is called in a couple of places in
libstdc++.a (eh_alloc.o and debug.o).

Also, __iso23_sscanf() gets called in the Fedora-built shared library
libboost_filesystem.so.

Eventually, we should implement __iso23_*() to really support binary
constants. More likely, we'll wait for Musl to implement it and adopt
their implementation. Until then, the simple workaround in this patch
to make the __iso23_*() functions alias of the classic functions().
It won't work for applications that really need their parsing functions
to support binary constants - but I doubt any such application really
exists today so I don't feel any urgency to implement it today.

After this patch
scripts/build image=rogue
scripts/run

Fully works on Fedora 39. Building the default Lua shell (scripts/build
without parameters) works, but when running it, __openat64_2 is missing
(the is Refs #1299)

Fixes #1301

Signed-off-by: Nadav Har'El <n...@scylladb.com>

---
diff --git a/libc/aliases.ld b/libc/aliases.ld
--- a/libc/aliases.ld
+++ b/libc/aliases.ld
@@ -76,3 +76,12 @@ _Exit = exit;

__dn_expand = dn_expand;
__sysconf = sysconf;
+
+/* glibc uses these functions as C23 versions of the existing functions,
+ which are supposed to also allow binary constants (0b...). So they
+ should be slightly different than the classic functions, but until
+ we implement that, lets at least support them as an alias - see
+ issue #1299.
+*/
+__isoc23_strtoul = strtoul;
+__isoc23_sscanf = sscanf;
diff --git a/scripts/setup.py b/scripts/setup.py
--- a/scripts/setup.py
+++ b/scripts/setup.py
@@ -157,8 +157,15 @@ class Fedora_38(object):
ec2_post_install = None
version = '38'

+ class Fedora_39(object):
+ packages = []
+ ec2_packages = []
+ test_packages = []
+ ec2_post_install = None
+ version = '39'
+
versions = [
- Fedora_27, Fedora_28, Fedora_29, Fedora_30, Fedora_31, Fedora_32, Fedora_33, Fedora_34, Fedora_35, Fedora_37, Fedora_38
+ Fedora_27, Fedora_28, Fedora_29, Fedora_30, Fedora_31, Fedora_32, Fedora_33, Fedora_34, Fedora_35, Fedora_37, Fedora_38, Fedora_39
]


Reply all
Reply to author
Forward
0 new messages