[RFC] [PATCH] To fix systemtap build error on s390 systems

Srinivasa DS srinivasa@in.ibm.com
Wed Jun 4 16:11:00 GMT 2008


systemtap build fails on s390 system with following error message, if 
-fpie option is used. Reason for this failure is -fpie/-fpic option, 
which puts limit on size of GOT(Global Offset table). we can overcome 
this problem with the usage of -fPIE/-fPIC option, which doesn't put any 
limit on size of GOT.

Documentation of options can be found here.
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Code-Gen-Options.html#index-fpic-1614

=============================================================
g++ -m64 -Wall -Werror -g -fpie   -pie -Wl,-z,relro -Wl,-z,now -pie 
-Wl,-z,relro -Wl,-z,now -Llib-elfutils -Wl,-rpath-link,lib-elfutils 
-Wl,--enable-new-dtags,-rpath,/usr/local/lib/systemtap  -o stap 
stap-main.o stap-parse.o stap-staptree.o stap-elaborate.o 
stap-translate.o stap-tapsets.o stap-buildrun.o stap-loc2c.o stap-hash.o 
stap-mdfour.o stap-cache.o stap-util.o stap-coveragedb.o -ldw -lebl 
-lsqlite3
stap-main.o: In function `__static_initialization_and_destruction_0':
/usr/lib/gcc/s390x-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:76: 
relocation truncated to fit: R_390_GOT12 against symbol `__dso_handle' 
defined in .data.rel.ro section in 
/usr/lib/gcc/s390x-redhat-linux/4.1.2/crtbeginS.o
stap-main.o: In function `printscript':
=====================================================

Iam attaching a patch, which solves this problem on s390, I have tested 
this on x86_64,x86,ppc64 and on s390 systems(I haven't tested this 
option on ia64). Please let me know your comments on this.

Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>


---
  configure    |    4 ++--
  configure.ac |    4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)

Index: systemtap/configure
===================================================================
--- systemtap.orig/configure
+++ systemtap/configure
@@ -6022,8 +6022,8 @@ if test "x$enable_pie" != xno; then
     save_CFLAGS="$CFLAGS"
     save_CXXFLAGS="$CXXFLAGS"
     save_LDFLAGS="$LDFLAGS"
-   CFLAGS="$CFLAGS -fpie"
-   CXXFLAGS="$CXXFLAGS -fpie"
+   CFLAGS="$CFLAGS -fPIE"
+   CXXFLAGS="$CXXFLAGS -fPIE"
     LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
     cat >conftest.$ac_ext <<_ACEOF
  void main () {}
Index: systemtap/configure.ac
===================================================================
--- systemtap.orig/configure.ac
+++ systemtap/configure.ac
@@ -87,8 +87,8 @@ AS_IF([test "x$enable_pie" != xno],[
     save_CFLAGS="$CFLAGS"
     save_CXXFLAGS="$CXXFLAGS"
     save_LDFLAGS="$LDFLAGS"
-   CFLAGS="$CFLAGS -fpie"
-   CXXFLAGS="$CXXFLAGS -fpie"
+   CFLAGS="$CFLAGS -fPIE"
+   CXXFLAGS="$CXXFLAGS -fPIE"
     LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
     AC_LINK_IFELSE([void main () {}], [
         AC_MSG_NOTICE([Compiling with gcc pie et al.])



More information about the Systemtap mailing list