[前][次][番号順一覧][スレッド一覧]

ruby-changes:17336

From: nobu <ko1@a...>
Date: Sat, 25 Sep 2010 10:36:49 +0900 (JST)
Subject: [ruby-changes:17336] Ruby:r29341 (trunk): * configure.in (LIBRUBY_DLDFLAGS): use -unexported_symbol only

nobu	2010-09-25 10:30:52 +0900 (Sat, 25 Sep 2010)

  New Revision: 29341

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29341

  Log:
    * configure.in (LIBRUBY_DLDFLAGS): use -unexported_symbol only
      when available.  http://trac.macports.org/ticket/26341

  Modified files:
    trunk/ChangeLog
    trunk/configure.in

Index: configure.in
===================================================================
--- configure.in	(revision 29340)
+++ configure.in	(revision 29341)
@@ -302,7 +302,7 @@
 ASFLAGS=$ASFLAGS
 AC_SUBST(ASFLAGS)
 
-AS_CASE(["$target_os"],[cygwin*|mingw*|darwin*], [ac_cv_prog_ac_ct_OBJCOPY=":"])
+AS_CASE(["$target_os"],[cygwin*|mingw*], [ac_cv_prog_ac_ct_OBJCOPY=":"])
 
 # BSD's ports and MacPorts prefix GNU binutils with 'g'
 AC_CHECK_TOOLS(OBJDUMP, [objdump gobjdump])
@@ -419,6 +419,21 @@
     save_CFLAGS=
 ])
 
+AC_DEFUN(RUBY_TRY_LDFLAGS, [
+    save_LDFLAGS="$LDFLAGS"
+    LDFLAGS="[$]LDFLAGS $1"
+    AC_MSG_CHECKING([whether ]$1[ is accepted])
+    RUBY_WERROR_FLAG([
+    AC_TRY_LINK([$4], [$5],
+	[$2
+	AC_MSG_RESULT(yes)],
+	[$3
+	AC_MSG_RESULT(no)])
+    ])
+    LDFLAGS="$save_LDFLAGS"
+    save_LDFLAGS=
+])
+
 if test "$GCC:${warnflags+set}:no" = yes::no; then
     for wflag in -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings \
 		 -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long; do
@@ -431,6 +446,14 @@
 if test "$GCC" = yes; then
     RUBY_TRY_CFLAGS(-fvisibility=hidden, [RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden)])
 fi
+if test "$GCC" = yes; then
+    if test "$visibility_option" = yes; then
+	RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden)
+    else
+	RUBY_TRY_LDFLAGS(['-Wl,-unexported_symbol,_Init_*'], [visibility_option=ld], [visibility_option=no])
+    fi
+    test "$visibility_option" = no || OBJCOPY=:
+fi
 
 test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\""
 test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\""
@@ -2180,6 +2203,10 @@
 	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)'
 	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(MAJOR).$(MINOR).$(TEENY)'
 	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-compatibility_version $(ruby_version)'
+	if test "$visibility_option" = ld; then
+	    LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_*'
+	    LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*'
+	fi
 	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)'
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).dylib'
 	LIBRUBY_ALIASES='lib$(RUBY_BASE_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_INSTALL_NAME).dylib'
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29340)
+++ ChangeLog	(revision 29341)
@@ -1,3 +1,8 @@
+Sat Sep 25 10:30:37 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (LIBRUBY_DLDFLAGS): use -unexported_symbol only
+	  when available.  http://trac.macports.org/ticket/26341
+
 Sat Sep 25 10:05:49 2010  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* configure.in: Always add -mieee for Renesas SH4.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]