Skip to content

libcrypt.map: Include xcrypt compat-symbols with obsolete API only. - #215

Merged
besser82 merged 1 commit into
developfrom
topic/besser82/issue181
Nov 6, 2025
Merged

libcrypt.map: Include xcrypt compat-symbols with obsolete API only.#215
besser82 merged 1 commit into
developfrom
topic/besser82/issue181

Conversation

@besser82

@besser82 besser82 commented Nov 6, 2025

Copy link
Copy Markdown
Owner

Also enforce the linker to fail, if there are undefined symbols present in the generated version-script, and the linker accepts a special flag to enable such a behaviour.

Fixes #181, #213.

@besser82 besser82 self-assigned this Nov 6, 2025
@codecov

codecov Bot commented Nov 6, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (0aedef9) to head (42295eb).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #215   +/-   ##
========================================
  Coverage    90.11%   90.11%           
========================================
  Files           36       36           
  Lines         3762     3762           
  Branches       738      738           
========================================
  Hits          3390     3390           
  Misses         238      238           
  Partials       134      134           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@besser82
besser82 force-pushed the topic/besser82/issue181 branch from 50eed40 to 5a9c029 Compare November 6, 2025 12:24
@besser82 besser82 linked an issue Nov 6, 2025 that may be closed by this pull request
satmandu added a commit to chromebrew/chromebrew that referenced this pull request Nov 6, 2025
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
satmandu added a commit to chromebrew/chromebrew that referenced this pull request Nov 6, 2025
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
@satmandu

satmandu commented Nov 6, 2025

Copy link
Copy Markdown

This does not fix the build when using the mold linker with lto enabled.

I have a failure building on i686 with Glibc 2.23, x86_64 with Glibc 2.27, and armv7l with Glibc 2.27.

This is the end of the i686 build:


libtool: link: gcc -shared  -fPIC -DPIC  lib/.libs/libcrypt_la-alg-des-tables.o lib/.libs/libcrypt_la-alg-des.o lib/.libs/libcrypt_la-alg-gost3411-2012-core.o lib/.libs/libcrypt_la-alg-gost3411-2012-hmac.o lib/.libs/libcrypt_la-alg-hmac-sha1.o lib/.libs/libcrypt_la-alg-md4.o lib/.libs/libcrypt_la-alg-md5.o lib/.libs/libcrypt_la-alg-sha1.o lib/.libs/libcrypt_la-alg-sha256.o lib/.libs/libcrypt_la-alg-sha512.o lib/.libs/libcrypt_la-alg-sm3.o lib/.libs/libcrypt_la-alg-sm3-hmac.o lib/.libs/libcrypt_la-alg-yescrypt-common.o lib/.libs/libcrypt_la-alg-yescrypt-opt.o lib/.libs/libcrypt_la-crypt-bcrypt.o lib/.libs/libcrypt_la-crypt-des.o lib/.libs/libcrypt_la-crypt-gensalt-static.o lib/.libs/libcrypt_la-crypt-gost-yescrypt.o lib/.libs/libcrypt_la-crypt-sm3-yescrypt.o lib/.libs/libcrypt_la-crypt-md5.o lib/.libs/libcrypt_la-crypt-nthash.o lib/.libs/libcrypt_la-crypt-pbkdf1-sha1.o lib/.libs/libcrypt_la-crypt-scrypt.o lib/.libs/libcrypt_la-crypt-sha256.o lib/.libs/libcrypt_la-crypt-sha512.o lib/.libs/libcrypt_la-crypt-sm3.
mold: warning: ./libcrypt.map: cannot assign version `GLIBC_2.0` to symbol `encrypt`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `GLIBC_2.0` to symbol `encrypt_r`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `GLIBC_2.0` to symbol `fcrypt`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `GLIBC_2.0` to symbol `setkey`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `GLIBC_2.0` to symbol `setkey_r`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `XCRYPT_2.0` to symbol `crypt_gensalt_r`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `XCRYPT_2.0` to symbol `xcrypt`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `XCRYPT_2.0` to symbol `xcrypt_gensalt`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `XCRYPT_2.0` to symbol `xcrypt_gensalt_r`: symbol not found
mold: warning: ./libcrypt.map: cannot assign version `XCRYPT_2.0` to symbol `xcrypt_r`: symbol not found
In function '_crypt_sha1_process_bytes',
    inlined from '_crypt_sha1_finish_ctx.isra' at lib/alg-sha1.c:265:3:
lib/alg-sha1.c:244:9: error: 'sha1_do_transform' reading 64 bytes from a region of size 1 [-Werror=stringop-overread]
  244 |         sha1_do_transform (ctx->state, (const uint8_t*)buffer + i);
      |         ^
lib/alg-sha1.c:244:9: note: referencing argument 2 of type 'const uint8_t[64]'
lib/alg-sha1.c: In function '_crypt_sha1_finish_ctx.isra':
lib/alg-sha1.c:103:1: note: in a call to function 'sha1_do_transform'
  103 | sha1_do_transform (uint32_t state[5], const uint8_t buffer[64])
      | ^
In function '_crypt_sha1_process_bytes',
    inlined from '_crypt_sha1_finish_ctx.isra' at lib/alg-sha1.c:267:5:
lib/alg-sha1.c:244:9: error: 'sha1_do_transform' reading 64 bytes from a region of size 1 [-Werror=stringop-overread]
  244 |         sha1_do_transform (ctx->state, (const uint8_t*)buffer + i);
      |         ^
lib/alg-sha1.c:244:9: note: referencing argument 2 of type 'const uint8_t[64]'
lib/alg-sha1.c: In function '_crypt_sha1_finish_ctx.isra':
lib/alg-sha1.c:103:1: note: in a call to function 'sha1_do_transform'
  103 | sha1_do_transform (uint32_t state[5], const uint8_t buffer[64])
      | ^
lto1: all warnings being treated as errors
make[2]: *** [/usr/local/tmp/cc8Rm7nL.mk:2: /usr/local/tmp/ccYDvjDJ.ltrans0.ltrans.o] Error 1
make[2]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
mold: fatal: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1646: libcrypt.la] Error 1
make[1]: Leaving directory '/usr/local/tmp/crew/libxcrypt.20251106134649.dir/libxcrypt-4.5.0'
make: *** [Makefile:1469: all] Error 2
There was a build error.
`CFLAGS="-O3 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold  -flto=auto -flto=auto" CXXFLAGS="-O3 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold  -flto=auto -flto=auto" FCFLAGS="-O3 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold  -flto=auto -flto=auto" FFLAGS="-O3 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold  -flto=auto -flto=auto" LDFLAGS="-flto=auto" CREW_PRELOAD_ENABLE_COMPILE_HACKS="1" CC_LD="mold" CXX_LD="mold" CREW_PRELOAD_NO_MOLD="0" make -j 4` exited with 2

My workaround was disabling lto and using LD_FLAGS=-Wl,--undefined-version, which fixes the builds on all three architectures.

Here are the build logs from the GitHub Action build at https://github.com/chromebrew/chromebrew/actions/runs/19137680153/job/54693917795:
i686: 11_Run Updater in container.txt
armv7l: 11_Run Updater in container.txt
x86_64: 11_Run Updater in container.txt

@besser82
besser82 force-pushed the topic/besser82/issue181 branch from 5a9c029 to 91fe047 Compare November 6, 2025 14:23
Some linkers, like lld or mold, will fail linking, if the version-script
contains mappings for missing symbols.

Fixes #181, #213.
@besser82
besser82 force-pushed the topic/besser82/issue181 branch from 91fe047 to 42295eb Compare November 6, 2025 14:26
@besser82

besser82 commented Nov 6, 2025

Copy link
Copy Markdown
Owner Author

@satmandu Can you please re-run the workflow with the updated PR?

@satmandu

satmandu commented Nov 6, 2025

Copy link
Copy Markdown

@satmandu Can you please re-run the workflow with the updated PR?

That didn't help. I'm seeing this on all three architectures. I am using the current version of mold with GCC 15.2.

Screenshot_20251106-120952.png

@besser82
besser82 merged commit 42295eb into develop Nov 6, 2025
101 checks passed
@besser82
besser82 deleted the topic/besser82/issue181 branch November 6, 2025 21:18
satmandu added a commit to chromebrew/chromebrew that referenced this pull request Nov 8, 2025
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
github-merge-queue Bot pushed a commit to chromebrew/chromebrew that referenced this pull request Nov 8, 2025
…-1 (#13374)

* Test libxcrypt with besser82/libxcrypt#215

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust libxcrypt build.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust linker options.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* xcryptest: Package File Update Run on linux/386 container.

* xcryptest: Package File Update Run on linux/amd64 container.

* xcryptest: Package File Update Run on linux/arm/v7 container.

* Remove workaround code.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: chromebrew-actions[bot] <chromebrew-actions[bot]@users.noreply.github.com>
satmandu added a commit to chromebrew/chromebrew that referenced this pull request Nov 21, 2025
…-1 (#13374)

* Test libxcrypt with besser82/libxcrypt#215

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust libxcrypt build.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust linker options.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* xcryptest: Package File Update Run on linux/386 container.

* xcryptest: Package File Update Run on linux/amd64 container.

* xcryptest: Package File Update Run on linux/arm/v7 container.

* Remove workaround code.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: chromebrew-actions[bot] <chromebrew-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants