|
From: | Bruno Haible |
Subject: | malloc-gnu, calloc-gnu, realloc-gnu, fopen-gnu, getpass-gnu: Allow use as dependency from test modules |
Date: | Mon, 03 Jan 2022 16:40:06 +0100 |
While testing a current libunistring snapshot on AIX 7 in 64-bit mode, I get a link error while creating the shared library: ld: 0711-317 ERROR: Undefined symbol: .rpl_malloc What happens here is that - Among the main modules (those built in lib/), we have 'malloc-posix' as a dependency but not 'malloc-gnu'. - Among the tests modules, we have 'malloc-gnu' as a dependency. - Because of the latter, REPLACE_MALLOC gets set to 1, and this gets substituted into lib/stdlib.h, providing an '#define malloc rpl_malloc' indirection for *both* lib/ and tests/. We knew that having 'malloc-gnu' as a dependency of tests modules would be a problem, as witnessed by this Comment: This module should not be used as a dependency from a test module, otherwise when this module occurs as a tests-related module, it will have side effects on the compilation of the main modules in lib/. Unfortunately, we now have (since 2021-04-18) this dependency chain: Many tests --> xalloc --> malloc-gnu --> calloc-gnu --> realloc-gnu --> reallocarray --> realloc-gnu --> ialloc --> malloc-gnu --> calloc-gnu --> realloc-gnu --> reallocarray --> realloc-gnu It would be a large effort (and a step backwards) to cut down all these dependencies. Therefore here are patches that actually make it possible to use 'malloc-gnu' as a dependency of tests modules, and likewise for the others. I'm leaving the fnmatch-gnu, getopt-gnu, and math (*-ieee) modules as they are, because they already use a different but working mechanism, based on m4_divert_text. 2022-01-03 Bruno Haible <bruno@clisp.org> getpass-gnu: Allow use as dependency from test modules. * m4/getpass.m4 (gl_FUNC_GETPASS_GNU): Set REPLACE_GETPASS_FOR_GETPASS_GNU instead of REPLACE_GETPASS. * m4/unistd_h.m4 (gl_UNISTD_H_REQUIRE_DEFAULTS): Initialize the getpass-gnu module indicator. (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETPASS_FOR_GETPASS_GNU. * modules/unistd (Makefile.am): Substitute GNULIB_GETPASS_GNU, REPLACE_GETPASS_FOR_GETPASS_GNU. * modules/getpass-gnu (configure.ac): Test REPLACE_GETPASS_FOR_GETPASS_GNU instead of REPLACE_GETPASS. Set a module indicator. * lib/unistd.in.h (getpass): Test REPLACE_GETPASS, REPLACE_GETPASS_FOR_GETPASS_GNU, and the respective module indicators instead of just REPLACE_GETPASS. 2022-01-03 Bruno Haible <bruno@clisp.org> fopen-gnu: Allow use as dependency from test modules. * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Set REPLACE_FOPEN_FOR_FOPEN_GNU instead of REPLACE_FOPEN. * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize the fopen-gnu module indicator. (gl_STDIO_H_DEFAULTS): Initialize REPLACE_FOPEN_FOR_FOPEN_GNU. * modules/stdio (Makefile.am): Substitute GNULIB_FOPEN_GNU, REPLACE_FOPEN_FOR_FOPEN_GNU. * modules/fopen-gnu (Depends-on): Add more dependencies. (configure.ac): Test REPLACE_FOPEN_FOR_FOPEN_GNU instead of REPLACE_FOPEN. * lib/stdio.in.h (fopen): Test REPLACE_FOPEN, REPLACE_FOPEN_FOR_FOPEN_GNU, and the respective module indicators instead of just REPLACE_FOPEN. 2022-01-03 Bruno Haible <bruno@clisp.org> realloc-gnu: Allow use as dependency from test modules. * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Set REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC. (gl_FUNC_REALLOC_POSIX): Set REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the realloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC. * modules/realloc-posix (Depends-on, configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC. * modules/realloc-gnu (Comment): Remove section. (Depends-on): Add free-posix, malloc-gnu, xalloc-oversized. (configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC. Set a module indicator. * lib/stdlib.in.h (realloc): Test REPLACE_REALLOC_FOR_REALLOC_POSIX, REPLACE_REALLOC_FOR_REALLOC_GNU, and the respective module indicators instead of just REPLACE_REALLOC. 2022-01-03 Bruno Haible <bruno@clisp.org> calloc-gnu: Allow use as dependency from test modules. * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Set REPLACE_CALLOC_FOR_CALLOC_GNU instead of REPLACE_CALLOC. (gl_FUNC_CALLOC_POSIX): Set REPLACE_CALLOC_FOR_CALLOC_POSIX instead of REPLACE_CALLOC. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the calloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_CALLOC_FOR_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_POSIX, not REPLACE_CALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_POSIX, not REPLACE_CALLOC. * modules/calloc-posix (Depends-on, configure.ac): Test REPLACE_CALLOC_FOR_CALLOC_POSIX instead of REPLACE_CALLOC. * modules/calloc-gnu (Depends-on): Add xalloc-oversized. (configure.ac): Test REPLACE_CALLOC_FOR_CALLOC_GNU instead of REPLACE_CALLOC. Set a module indicator. * lib/stdlib.in.h (calloc): Test REPLACE_CALLOC_FOR_CALLOC_POSIX, REPLACE_CALLOC_FOR_CALLOC_GNU, and the respective module indicators instead of just REPLACE_CALLOC. 2022-01-03 Bruno Haible <bruno@clisp.org> malloc-gnu: Allow use as dependency from test modules. * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Set REPLACE_MALLOC_FOR_MALLOC_GNU instead of REPLACE_MALLOC. (gl_FUNC_MALLOC_PTRDIFF, gl_FUNC_MALLOC_POSIX): Set REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC. * m4/calloc.m4 (gl_FUNC_CALLOC_POSIX): Test REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC. * m4/realloc.m4 (gl_FUNC_REALLOC_POSIX): Likewise. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the malloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MALLOC_FOR_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_POSIX, not REPLACE_MALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_POSIX, not REPLACE_MALLOC. * modules/malloc-posix (Depends-on, configure.ac): Test REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC. * modules/malloc-gnu (Comment): Remove section. (Depends-on): Add xalloc-oversized. (configure.ac): Test REPLACE_MALLOC_FOR_MALLOC_GNU instead of REPLACE_MALLOC. Set a module indicator. * lib/stdlib.in.h (malloc): Test REPLACE_MALLOC_FOR_MALLOC_POSIX, REPLACE_MALLOC_FOR_MALLOC_GNU, and the respective module indicators instead of just REPLACE_MALLOC.
0001-malloc-gnu-Allow-use-as-dependency-from-test-modules.patch
Description: Text Data
0002-calloc-gnu-Allow-use-as-dependency-from-test-modules.patch
Description: Text Data
0003-realloc-gnu-Allow-use-as-dependency-from-test-module.patch
Description: Text Data
0004-fopen-gnu-Allow-use-as-dependency-from-test-modules.patch
Description: Text Data
0005-getpass-gnu-Allow-use-as-dependency-from-test-module.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |