Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore compatibility with glibc<=2.33 for global initializers #10587

Merged
merged 3 commits into from
Jan 14, 2022

Conversation

xxxbxxx
Copy link
Contributor

@xxxbxxx xxxbxxx commented Jan 13, 2022

Tentative fix for #10386 #10512

I've just conditionally restored some code from before 19ca241
to get _start to pass an init() fonction to __libc_start_main.

appears to work, but I've just tested with system glibc 2.33. (didn't test for no regression in 2.34 for ex.)

Is this the correct thing to do?

I've manually restored the old files, expecting this to be done 'once' and the files kept unchanged for future glibc versions. But maybe it is needed to update the tools/upadte_glibc?

@xxxbxxx xxxbxxx changed the title (draft) restore compatibility with glibc<=2.33 for global initializers restore compatibility with glibc<=2.33 for global initializers Jan 13, 2022
@andrewrk
Copy link
Member

This looks reasonable, thanks! I'll add another commit with some minor organization and then merge.

xxxbxxx and others added 3 commits January 14, 2022 11:48
__libc_start_main() from glibc.2.33.so or older needs to have a __libc_csu_init function callback parameter.

glibc-2.34 on the other hand has a different __libc_start_main() that does not use it,
and the start.S file from glibc-2.34 no longer construct the init function and pass null when calling __libc_start_main.

So, When targetting an older glibc, use the start.s files as they were in glibc-2.33 and construct the __libc_csu_init function.

fixes ziglang#10386 ziglang#10512
also use the common naming convention for glibc versions ("2.33" rather
than "2-33").

I also verified that these files are exactly identical to the previous
files from before zig updated to glibc 2.34.
@andrewrk andrewrk merged commit 1e481df into ziglang:master Jan 14, 2022
uhthomas pushed a commit to gmirror/bazel-zig-cc that referenced this pull request Jan 15, 2022
scorphus pushed a commit to scorphus/zig that referenced this pull request Jan 15, 2022
restore compatibility with glibc<=2.33 for global initializers
@motiejus
Copy link
Contributor

Thanks for this! It unblocked bazel-zig-cc1 to use post-0.9.0 zig. Please let me know your name/alias if you want better credit than this2.

andrewrk added a commit that referenced this pull request Feb 3, 2022
restore compatibility with glibc<=2.33 for global initializers
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.

None yet

3 participants