Discussion:
Bug#1098956: cmake: FTBFS on hppa - /usr/bin/ld: warning: exec has a LOAD segment with RWX permissions
Add Reply
John David Anglin
2025-02-26 16:40:01 UTC
Reply
Permalink
Source: cmake
Version: 3.31.5-2
Severity: normal

Dear Maintainer,

Binutils ld has a new warning. It is causing builds for a number of
packages to fail. For cmake, it causes the following tests to fail
on hppa and sparc:

The following tests FAILED:
365 - RunCMake.CMP0119 (Failed)
384 - RunCMake.Make (Failed)
390 - RunCMake.Autogen_Qt6_1 (Failed)
391 - RunCMake.Autogen_Qt6_2 (Failed)
392 - RunCMake.Autogen_Qt6_3 (Failed)
393 - RunCMake.Autogen_Qt6_4 (Failed)
394 - RunCMake.Autogen_Qt6_5 (Failed)
395 - RunCMake.Autogen_Qt6_6 (Failed)
396 - RunCMake.BuildDepends (Failed) Fortran
398 - RunCMake.Byproducts (Failed)
410 - RunCMake.ExcludeFromAll (Failed)
411 - RunCMake.ExportImport (Failed)
446 - RunCMake.GoogleTest (Failed)
452 - RunCMake.ObjectLibrary (Failed)
455 - RunCMake.RuntimePath (Failed)
460 - RunCMake.TargetObjects (Failed)
478 - RunCMake.add_custom_command (Failed)
483 - RunCMake.add_subdirectory (Failed) Fortran
544 - RunCMake.test_include_dirs (Failed)
554 - RunCMake.InterfaceLibrary (Failed)
559 - RunCMake.DependencyGraph (Failed) Fortran
566 - RunCMake.LinkLibrariesStrategy (Failed)
576 - RunCMake.target_link_libraries-LINK_LIBRARY (Failed)
577 - RunCMake.target_link_libraries-LINK_GROUP (Failed)
578 - RunCMake.add_link_options (Failed)
579 - RunCMake.target_link_options (Failed) CUDA
585 - RunCMake.target_sources (Failed)
595 - RunCMake.file-GET_RUNTIME_DEPENDENCIES (Failed)
607 - RunCMake.CrosscompilingEmulator (Failed)
616 - RunCMake.CompilerArgs (Failed)
620 - RunCMake.CPack_DEB.DEBUGINFO (Failed)
622 - RunCMake.CPack_DEB.DEPENDENCIES (Failed)
626 - RunCMake.CPack_DEB.GENERATE_SHLIBS (Failed)
627 - RunCMake.CPack_DEB.GENERATE_SHLIBS_LDCONFIG (Failed)
650 - RunCMake.PrecompileHeaders (Failed)
651 - RunCMake.UnityBuild (Failed) CUDA
657 - RunCMake.VerifyHeaderSets (Failed)
659 - RunCMake.Codegen (Failed)
Errors while running CTest

For example,

CMake Error at /build/reproducible-path/cmake-3.31.6/Tests/RunCMake/RunCMake.cmake:286 (message):
PchLibObjLibExe-build - FAILED:

stderr does not match that expected.

Command was:

command> "/build/reproducible-path/cmake-3.31.6/Build/bin/cmake" "--build" "." "--config" "Debug"

Actual stdout:

actual-stdout> gmake[3]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[4]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 11%] Building CXX object CMakeFiles/base_lib_static.dir/cmake_pch.hxx.gch
actual-stdout> [ 22%] Building CXX object CMakeFiles/base_lib_static.dir/empty1.cpp.o
actual-stdout> [ 33%] Linking CXX static library libbase_lib_static.a
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 33%] Built target base_lib_static
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 44%] Building CXX object CMakeFiles/object_lib.dir/empty2.cpp.o
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 44%] Built target object_lib
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 55%] Building CXX object CMakeFiles/mid_lib_static.dir/empty3.cpp.o
actual-stdout> [ 66%] Linking CXX static library libmid_lib_static.a
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 66%] Built target mid_lib_static
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[5]: Entering directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [ 77%] Building CXX object CMakeFiles/exec.dir/cmake_pch.hxx.gch
actual-stdout> [ 88%] Building CXX object CMakeFiles/exec.dir/main.cpp.o
actual-stdout> [100%] Linking CXX executable exec
actual-stdout> gmake[5]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> [100%] Built target exec
actual-stdout> gmake[4]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'
actual-stdout> gmake[3]: Leaving directory '/build/reproducible-path/cmake-3.31.6/Build/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe-build'

Expected stderr to match:

expect-stderr> ^$

Actual stderr:

actual-stderr> /usr/bin/ld: warning: exec has a LOAD segment with RWX permissions

Full log is here:
https://buildd.debian.org/status/fetch.php?pkg=cmake&arch=hppa&ver=3.31.6-1&stamp=1740586340&raw=0

I believe this problem will eventually affect all arches, so maybe this
bug should be serious.

Regards,
Dave Anglin

-- System Information:
Debian Release: trixie/sid
APT prefers unreleased
APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 6.12.16-dirty (SMP w/4 CPU threads)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Brad King
2025-02-26 19:00:01 UTC
Reply
Permalink
Binutils ld has a new warning...it causes the following tests to fail
...
actual-stderr> /usr/bin/ld: warning: exec has a LOAD segment with RWX permissions
CMake's tests fail due to this unexpected incidental output from the toolchain.
I don't think the warning itself is a problem for binaries inside the
test suite.
I've opened an upstream CMake merge request to filter out that output:

* https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10398

-Brad
Dave Anglin
2025-02-26 21:30:01 UTC
Reply
Permalink
See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098970

The PLT section on hppa needs to be RWX.

Binutils is now configured with --enable-warn-rwx-segments.
--
John David Anglin ***@gmail.com
Dave Anglin
2025-03-01 16:40:01 UTC
Reply
Permalink
It is not clear why the warning was forced on all architectures. We have the following
code in ld/configure.tgt:

# By default the linker will generate warnings if it is creating an
# executable stack or a segment with all three of read, write and
# execute permissions. These settings are not appropriate for all
# targets however, so we can change them here:

if test "${ac_default_ld_warn_rwx_segments}" = unset; then
case "${targ}" in
# The CRIS and V850 default linker scripts yields just one segment
# as intended, so a rwx segment warning is not helpful.
# The HPPA's and SPARC's PLT sections use a constructed trampoline
# hence it needs to have a RWX segment.
# Many MIPS targets use executable segments.
cris-*-* | crisv32-*-* | \
hppa*-*-* | \
mips*-*-* | \
microblaze*-*-* | \
sparc*-*-* | \
v850*-*-*)
ac_default_ld_warn_rwx_segments=0
;;
*)
;;
esac
fi

Dave
--
John David Anglin ***@gmail.com
Loading...