Hello,

I found a reproducible C++ namespace compatibility failure involving
Gnulib’s fcntl-h module as bundled in GNU M4 1.4.21, and prepared a minimal
patch.

Affected file:
lib/fcntl.in.h

Observed environment:

   - GNU M4 1.4.21 bundled Gnulib
   - Linux AArch64
   - glibc 2.43
   - Clang/Clang++ 23.1.0
   - GCC/G++ 15.2.0
   - C++ support enabled

Problem:
With GNULIB_NAMESPACE enabled, the generated header reaches:

_GL_CXXALIASWARN (openat);

In the tested glibc/Clang environment, openat is visible as an overloaded
function set and Clang rejects the declaration with:

reference to overloaded function could not be resolved

The reduced case passes with G++ 15.2.0.

Patch:
Replace the generic warning alias with the overload-aware form matching
openat’s signature:

_GL_CXXALIASWARN1 (openat, int,
(int fd, char const
*file, int flags, /* mode_t mode */ …));

Validation on the recorded environment:

   - Clang 23 C++17 namespace: PASS
   - Clang 23 C++20 namespace: PASS
   - Clang 23 C++23 namespace: PASS
   - Clang 23 C++23 namespace without Fortify: PASS
   - Clang 23 C++23 without namespace: PASS
   - G++ 15 C++23 namespace: PASS

Fresh-build causal matrix:
ORIGINAL CONFIG=0 BUILD=0 FCNTL=2 FLOAT=0 CHECK=2
FLOAT_ONLY CONFIG=0 BUILD=0 FCNTL=2 FLOAT=0 CHECK=2
OPENAT_ONLY CONFIG=0 BUILD=0 FCNTL=0 FLOAT=0 CHECK=0
BOTH CONFIG=0 BUILD=0 FCNTL=0 FLOAT=0 CHECK=0

This isolates the openat patch as necessary and sufficient for the observed
failure in that environment. I am not claiming that AArch64 itself is the
cause.

Public finding:
https://github.com/frenchcryptonad-max/linux-arm64-build-findings/tree/main/findings/gnu-m4-1.4.21/clang23-aarch64-openat-namespace

Public validated fix:
https://github.com/frenchcryptonad-max/linux-arm64-build-findings/tree/main/fixes/gnu-m4-1.4.21/clang23-aarch64-openat-namespace

I also checked a current Gnulib mirror before sending; lib/fcntl.in.h still
uses _GL_CXXALIASWARN(openat), so this does not appear to have been
superseded there. This is only a source observation; the build validation
above is against the M4 1.4.21 bundled Gnulib.

Licensing:
The fcntl-h module metadata identifies the module as LGPLv2+, and current
lib/fcntl.in.h states GNU LGPL 2.1 or later. I offer this patch
contribution under GNU LGPL-2.1-or-later. OSARM-authored reports and
validation metadata in the attached package are offered under Apache-2.0;
upstream-derived patch context retains the Gnulib license.

I understand GNU/FSF copyright-assignment paperwork may be required for
acceptance. If paperwork is required for this contribution, please advise.

The attached archive contains the patch, validation summary, environment,
license notice, license texts and SHA-256 manifest. Privacy and hash checks
passed before sending.

Regards,
FrenchCryptoNad

Attachment: gnulib-openat-upstream-submission.tar.gz
Description: Binary data

Attachment: gnulib-openat-upstream-submission.tar.gz.sha256
Description: Binary data

Reply via email to