Skip to content

Conversation

@alexrp
Copy link
Member

@alexrp alexrp commented Jul 31, 2025

Closes #24579.

Copy link
Contributor

@rootbeer rootbeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked this over and have a question and some suggestions for ifdefs, but nothing worth holding up the PR for.

extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
libc_hidden_proto (__pthread_mutexattr_destroy)

extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like __pthread_mutexattr_settype went away, so this might need an Zig ifdef guard for older versions? I'm not confident about how this symbol would actually get referenced though, so maybe not? If you do bring it back, its also not clear to me if the new libc_hidden_proto should apply, or if the block of weak_extern/pragma below would need to be applied to this symbol?


#ifdef __USE_GNU
/* Return the Linux TID for THREAD_ID. Returns -1 on failure. */
extern pid_t pthread_gettid_np (pthread_t __thread_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this symbol is new for glibc 2.42, so Zig should probably have the #ifdef guard around it:

#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 42) || __GLIBC__ > 2

#endif

#if __GLIBC_USE (ISOC2Y)
extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of uabs/ulabs/'ullabs' prototypes should probably also get a Zig header, as I believethey were introduced in v2.42. Ah, but they're behind IOSC2Y` (which I understand to be "next version" of ISO C), so maybe Zig can wait until they get promoted out of that?

@alexrp
Copy link
Member Author

alexrp commented Aug 1, 2025

I looked this over and have a question and some suggestions for ifdefs, but nothing worth holding up the PR for.

We usually add these version checks on an as-needed basis when people need them, not proactively. PRs to do so are definitely welcome as follow-up work, but I'll go ahead and merge this one in any case.

The long-term solution to this problem is going to be something like universal-headers (currently vaporware).

@alexrp alexrp enabled auto-merge August 1, 2025 16:14
@alexrp alexrp merged commit a00edbd into ziglang:master Aug 1, 2025
10 checks passed
@alexrp alexrp deleted the glibc-2.42 branch August 1, 2025 19:25
@alexrp alexrp added the release notes This PR should be mentioned in the release notes. label Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes This PR should be mentioned in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

glibc 2.42 support

2 participants