Re: [DynInst_API:] cmake problem building with -pie


Date: Wed, 12 Aug 2020 13:53:47 -0500
From: thaines.astro@xxxxxxxxx
Subject: Re: [DynInst_API:] cmake problem building with -pie
Hi, Stan.

Support for big endian systems has been deprecated in Dyninst, and will likely be removed in the next release. When that happens, usage of the TestBigEndian internal CMake module will go away. It looks like you are using an x86_64 platform, so an immediate workaround is to get rid of most everything in cmake/endian.cmake (patch below).

Thanks.

Â- Tim


diff --git a/cmake/endian.cmake b/cmake/endian.cmake
index c0be21b..1171cae 100644
--- a/cmake/endian.cmake
+++ b/cmake/endian.cmake
@@ -1,8 +1 @@
-INCLUDE(TestBigEndian)
-
-TEST_BIG_ENDIAN(BIGENDIAN)
-if(${BIGENDIAN})
- ADD_DEFINITIONS(-DDYNINST_BIG_ENDIAN)
-else()
- ADD_DEFINITIONS(-DDYNINST_LITTLE_ENDIAN)
-endif(${BIGENDIAN})
+ADD_DEFINITIONS(-DDYNINST_LITTLE_ENDIAN)



On Tue, Aug 11, 2020 at 9:30 PM Stan Cox <scox@xxxxxxxxxx> wrote:
I came across the following while building 10.2.0 on Fedora, which
builds all packages with -pie

Simplified example:

 % rm CMakeCache.txt ; LDFLAGS=-pie /usr/bin/cmake .
...
-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:50 (message):
 Âno suitable type found
Call Stack (most recent call first):
 Âcmake/endian.cmake:3 (TEST_BIG_ENDIAN)
 Âcmake/shared.cmake:93 (include)
 ÂCMakeLists.txt:34 (include)
-- Configuring incomplete, errors occurred!

Without LDFLAGS=-pie works okay
...
-- Configuring done
-- Generating done
-- Build files have been written to: ...
-- RTlib Makefile:
-- Found LATEX: /usr/bin/latex
-- Adding Unix-specific dependencies
-- Configuring done
-- Generating done
-- Build files have been written to: ...


Looking at /usr/share/cmake/Modules/TestBigEndian.cmake the problem
seems to be when compiling /usr/share/cmake/Modules/TestEndianess.c.in
% gcc test.c -Wl,-pie
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/crtbegin.o: relocation
R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when
making a PIE object
/usr/bin/ld: /tmp/ccM6S7QV.o: relocation R_X86_64_32S against symbol
`info_little' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
[← Prev in Thread] Current Thread [Next in Thread→]