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

Fix building with z_ prefix #936

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

DenizThatMenace
Copy link

This PR fixes a problem with the version-script (zlib.map) when also building with enabled z_ prefix for the function names.

Without the changes from this PR the version-script did not properly assign version numbers to the function symbols in zlib.so (using GCC or Clang) if the function symbols are prefixed with z_!


Background

Most linkers silently ignored this error and just generated a zlib.so without any version numbers attached. Starting with lld 16, however, linking even fails with the following errors:

ld.lld-16: error: version script assignment of 'ZLIB_1.2.0' to symbol 'compressBound' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0' to symbol 'deflateBound' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0' to symbol 'inflateBack' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0' to symbol 'inflateBackEnd' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0' to symbol 'inflateBackInit_' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0' to symbol 'inflateCopy' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'deflate_copyright' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'inflate_copyright' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'inflate_fast' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'inflate_table' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'zcalloc' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'zcfree' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'gz_error' failed: symbol not defined
ld.lld-16: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0.2' to symbol 'gzclearerr' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0.2' to symbol 'gzungetc' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0.2' to symbol 'zlibCompileFlags' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.0.8' to symbol 'deflatePrime' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.2' to symbol 'adler32_combine' failed: symbol not defined
ld.lld-16: error: version script assignment of 'ZLIB_1.2.2' to symbol 'crc32_combine' failed: symbol not defined
ld.lld-16: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

The reason is that zlib.map did not care whether the z_ prefix is used or not.

@DenizThatMenace DenizThatMenace changed the title Fix building with zprefix Fix building with z_ prefix Feb 13, 2024
This also fixes out-of-source builds when the `-zprefix` option was
given to the configure script.
@Neustradamus
Copy link

@madler: Have you seen this PR?

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

2 participants