Skip to content

Commit e496c54

Browse files
DerDakonbradking
authored andcommitted
Linux/PA-RISC: Link with --unique=.text.* to help binutils
There is a binutils bug that leads to errors like this: /usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.6.3/../../../../hppa2.0-unknown-linux-gnu/bin/ld: libCMakeLib.a(cmTarget.cxx.o)(.text+0x12084): cannot reach 00001d28__ZNSspLEPKc@@GLIBCXX_3.4+0, recompile with -ffunction-sections /usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.6.3/../../../../hppa2.0-unknown-linux-gnu/bin/ld: libCMakeLib.a(cmTarget.cxx.o)(.text+0x12084): cannot handle R_PARISC_PCREL17F for std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+=(char const*)@@GLIBCXX_3.4 /usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.6.3/../../../../hppa2.0-unknown-linux-gnu/bin/ld: final link failed: Bad value Until someone finds out what needs to be fixed in binutils this allows anyone to compile a working CMake even in debug mode.
1 parent abe4edf commit e496c54

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

CompileFlags.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ endif ()
6262
if (CMAKE_ANSI_CFLAGS)
6363
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
6464
endif ()
65+
66+
# avoid binutils problem with large binaries, e.g. when building CMake in debug mode
67+
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
68+
if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
69+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*")
70+
endif ()

bootstrap

+21
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ else
9393
cmake_system_openvms=false
9494
fi
9595

96+
# Determine whether this is Linux
97+
if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
98+
cmake_system_linux=true
99+
# find out if it is a HP PA-RISC machine
100+
if uname -m | grep parisc >/dev/null 2>&1; then
101+
cmake_machine_parisc=true
102+
else
103+
cmake_machine_parisc=false
104+
fi
105+
else
106+
cmake_system_linux=false
107+
fi
108+
96109
# Choose the generator to use for bootstrapping.
97110
if ${cmake_system_mingw}; then
98111
# Bootstrapping from an MSYS prompt.
@@ -678,6 +691,14 @@ if ${cmake_system_haiku}; then
678691
cmake_ld_flags="${LDFLAGS} -lroot -lbe"
679692
fi
680693

694+
if ${cmake_system_linux}; then
695+
# avoid binutils problem with large binaries, e.g. when building CMake in debug mode
696+
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
697+
if ${cmake_machine_parisc}; then
698+
cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*"
699+
fi
700+
fi
701+
681702
#-----------------------------------------------------------------------------
682703
# Detect known toolchains on some platforms.
683704
cmake_toolchains=''

0 commit comments

Comments
 (0)