|
Message-ID: <20130722154551.GI3249@brightrain.aerifal.cx>
Date: Mon, 22 Jul 2013 11:45:51 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: C++ ABI TODO list
On Sat, Jul 20, 2013 at 01:26:14AM -0400, Rich Felker wrote:
> Here are the changes I'm aware of that would be needed to bring musl's
> C++ ABI in line with glibc/LSB, enabling C++ library reuse with musl:
> [...]
>
> I'm hoping the above list is all...
It wasn't. I've just committed the first patch for this agenda item,
massively refactoring the headers, reducing the dependency on the
alltypes system where it's not really needed, moving most of the
arch-generic types to a shared alltypes file, and fixing the
low-hanging fruit for ABI compatibility. The reason these changes were
committed together rather than either without the other is:
- Fixing ABI compatibility first would have been ugly when the same
type was scattered across multiple archs' alltypes files.
- Refactoring without fixing at least some of the low-hanging ABI
issues would have meant gratuitously writing new alltypes.h.in files
with the wrong types, only to rewrite them immediately in the next
commit.
The remaining differences from glibc:
- fd_mask signedness - glibc is wrong; their definition invokes UB
when used in the headers. I believe they're actually fixing the type
on their end anyway)
- jmp_buf and sigjmp_buf - fixing this requires changing the
underlying types to be the same, as discussed before, and is a much
more functional change than I wanted in this patch.
- pthread_*attr_t - despite just being single integers, glibc has
these wrapped in structures; changing musl to match will require
some minor code changes.
- regex_t - glibc's struct tag violates the namespace. we could change
it just in C++ mode, though...
- regoff_t - glibc's definition is wrong; it's too short on 64-bit
archs. but we could fix it on 32-bit archs.
- wint_t - glibc has wint_t defined as unsigned int on all archs
(actually it defers to gcc if gcc defines it, but gcc also defines
it as unsigned int on at least all current archs). since this is an
actual arithmetic type, not an opaque type like dev_t, I felt that
changing it as part of this commit would be too much of a functional
change. also I need to review whether any code in musl assumes it's
signed.
So this comes down to only 3-4 changes left to make, each of which
have some impact on the code (either change or just review for
correctness). In other words, the C++ ABI compatibility goal is almost
done.
For those interested, I'm attaching the C++ ABI check tool I've been
using. It's based on the type sizes check code from nsz's musl tools
repo, but with the macros changed (and hacked up a bit to remove
irrelevant types) to output C++ code that gets the compiler to do the
desired name mangling. The intended usage is:
g++ abi.cxx
nm abi.o | sed s/^.*check_// | sort
Then you can diff the outputs from different libcs/compilers to check
for compatibility and get a report of which types differ.
Rich
View attachment "abi.cxx" of type "text/plain" (7310 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.