![]() |
|
Message-ID: <5bd20b5d42a666d46e86a51ced3e9ff5d6bc0aa1.camel@alba.sh> Date: Thu, 20 Mar 2025 03:32:05 +0100 From: Alba Mendez <me@...a.sh> To: Rich Felker <dalias@...c.org>, Markus Wichmann <nullplan@....net>, musl@...ts.openwall.com Subject: Re: Making user libraries Y2038 compatible? Thank you all for your responses! I had indeed missed that musl doesn't implement the whole feature test macro / dual symbol system, and time_t / off_t are always 64-bit non-configurable. Thus libraries don't need to do anything special for musl, nice! > If you really want to do this, *please* don't make the *64() names > public API. Make it so they're automatically remapped if building on > a modern system where time_t is 64-bit or where 64-bit time_t is > available by request, and so the old symbol is just left there for > ABI compatibility with already-linked code using it. That's the idea, yes. Users are only expected to use the normal names, which will be conditionally remapped to the *64 versions through the #define. Users can still use the *64 names in their source code though, not sure how to prevent that :/ > So what is there to do? For applications, simply always set the above > two macros on glibc, then you get 64-bit types for time_t and off_t > and > all the others. On musl, you don't need to do anything. How to tell? > Configure tests. It is pretty easy to statically test the size of > types. > You just test if you get the right definitions at the outset, and if > not > you try again with these macros defined. > > For libraries, you must require this configuration at the outset. You > can put a static assert into your header files, for example. For > ABI compatibility, you may need to use symbol versioning and compat > definitions. Where the types become relevant ABI surface, you can > resort > to the stdint.h types. I am certainly okay with doing this on my libraries, but other projects may have the requirement for their (same) headers and .so binaries to work on applications that do not define these macros as well as ones that do. I'm not sure I'm in a position to tell them to just drop that requirement ^^' Alba
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.