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

ruby-changes:16713

From: nobu <ko1@a...>
Date: Thu, 22 Jul 2010 06:38:52 +0900 (JST)
Subject: [ruby-changes:16713] Ruby:r28709 (trunk): * configure.in (XCFLAGS): use -fvisibility=hidden if possible.

nobu	2010-07-22 06:38:25 +0900 (Thu, 22 Jul 2010)

  New Revision: 28709

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

  Log:
    * configure.in (XCFLAGS): use -fvisibility=hidden if possible.

  Modified files:
    trunk/ChangeLog
    trunk/common.mk
    trunk/configure.in
    trunk/cont.c
    trunk/debug.h
    trunk/dln.h
    trunk/encoding.c
    trunk/include/ruby/defines.h
    trunk/include/ruby/encoding.h
    trunk/include/ruby/intern.h
    trunk/include/ruby/io.h
    trunk/include/ruby/missing.h
    trunk/include/ruby/oniguruma.h
    trunk/include/ruby/re.h
    trunk/include/ruby/regex.h
    trunk/include/ruby/ruby.h
    trunk/include/ruby/st.h
    trunk/include/ruby/util.h
    trunk/include/ruby/version.h
    trunk/include/ruby/vm.h
    trunk/include/ruby/win32.h
    trunk/iseq.h
    trunk/regenc.h
    trunk/regint.h
    trunk/regparse.h
    trunk/transcode_data.h

Index: regparse.h
===================================================================
--- regparse.h	(revision 28708)
+++ regparse.h	(revision 28709)
@@ -31,6 +31,10 @@
 
 #include "regint.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /* node type */
 #define NT_STR         0
 #define NT_CCLASS      1
@@ -351,4 +355,8 @@
 #endif
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* ONIGURUMA_REGPARSE_H */
Index: encoding.c
===================================================================
--- encoding.c	(revision 28708)
+++ encoding.c	(revision 28709)
@@ -23,6 +23,17 @@
 #endif
 #include "ruby/util.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+int rb_enc_register(const char *name, rb_encoding *encoding);
+void rb_enc_set_base(const char *name, const char *orig);
+void rb_encdb_declare(const char *name);
+int rb_encdb_replicate(const char *name, const char *orig);
+int rb_encdb_dummy(const char *name);
+int rb_encdb_alias(const char *alias, const char *orig);
+#pragma GCC visibility pop
+#endif
+
 static ID id_encoding;
 VALUE rb_cEncoding;
 static VALUE rb_encoding_list;
Index: debug.h
===================================================================
--- debug.h	(revision 28708)
+++ debug.h	(revision 28709)
@@ -15,6 +15,10 @@
 #include "ruby/ruby.h"
 #include "node.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #define dpv(h,v) ruby_debug_print_value(-1, 0, h, v)
 #define dp(v)    ruby_debug_print_value(-1, 0, "", v)
 #define dpi(i)   ruby_debug_print_id(-1, 0, "", i)
@@ -33,4 +37,8 @@
 void ruby_set_debug_option(const char *str);
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* RUBY_DEBUG_H */
Index: include/ruby/missing.h
===================================================================
--- include/ruby/missing.h	(revision 28708)
+++ include/ruby/missing.h	(revision 28709)
@@ -49,6 +49,10 @@
 #define RUBY_EXTERN extern
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #ifndef HAVE_ACOSH
 RUBY_EXTERN double acosh(double);
 RUBY_EXTERN double asinh(double);
@@ -169,6 +173,10 @@
 RUBY_EXTERN int ffs(int);
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/regex.h
===================================================================
--- include/ruby/regex.h	(revision 28708)
+++ include/ruby/regex.h	(revision 28709)
@@ -24,6 +24,10 @@
 #include "oniguruma.h"
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #ifndef ONIG_RUBY_M17N
 
 ONIG_EXTERN OnigEncoding    OnigEncDefaultCharEncoding;
@@ -32,6 +36,10 @@
 
 #endif /* ifndef ONIG_RUBY_M17N */
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/defines.h
===================================================================
--- include/ruby/defines.h	(revision 28708)
+++ include/ruby/defines.h	(revision 28709)
@@ -49,6 +49,10 @@
 #define ANYARGS
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #define xmalloc ruby_xmalloc
 #define xmalloc2 ruby_xmalloc2
 #define xcalloc ruby_xcalloc
@@ -311,6 +315,10 @@
     RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/util.h
===================================================================
--- include/ruby/util.h	(revision 28708)
+++ include/ruby/util.h	(revision 28709)
@@ -40,6 +40,10 @@
 #endif
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #define scan_oct(s,l,e) (int)ruby_scan_oct(s,l,e)
 unsigned long ruby_scan_oct(const char *, size_t, size_t *);
 #define scan_hex(s,l,e) (int)ruby_scan_hex(s,l,e)
@@ -80,6 +84,10 @@
 
 void ruby_each_words(const char *, void (*)(const char*, int, void*), void *);
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 28708)
+++ include/ruby/intern.h	(revision 28709)
@@ -28,6 +28,10 @@
 #endif
 #include "ruby/st.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /*
  * Functions and variables that are used by more than one source file of
  * the kernel.
@@ -841,6 +845,10 @@
 void rb_frame_pop(void);
 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 28708)
+++ include/ruby/ruby.h	(revision 28709)
@@ -73,6 +73,10 @@
 
 #include "defines.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #if defined(HAVE_ALLOCA_H)
 #include <alloca.h>
 #else
@@ -1447,6 +1451,10 @@
 #define close ruby_close
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/vm.h
===================================================================
--- include/ruby/vm.h	(revision 28708)
+++ include/ruby/vm.h	(revision 28709)
@@ -19,6 +19,10 @@
 #endif
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /* Place holder.
  *
  * We will prepare VM creation/control APIs on 1.9.2 or later.
@@ -32,6 +36,10 @@
 /* core API */
 int ruby_vm_destruct(ruby_vm_t *vm);
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/win32.h
===================================================================
--- include/ruby/win32.h	(revision 28708)
+++ include/ruby/win32.h	(revision 28709)
@@ -8,6 +8,10 @@
 #endif
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /*
  *  Copyright (c) 1993, Intergraph Corporation
  *
@@ -662,6 +666,10 @@
 typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
 uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t* argv, uintptr_t intrval);
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/version.h
===================================================================
--- include/ruby/version.h	(revision 28708)
+++ include/ruby/version.h	(revision 28709)
@@ -36,6 +36,11 @@
 } /* satisfy cc-mode */
 #endif
 #endif
+
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /*
  * Interfaces from extension libraries.
  *
@@ -50,6 +55,11 @@
 RUBY_EXTERN const char ruby_description[];
 RUBY_EXTERN const char ruby_copyright[];
 RUBY_EXTERN const char ruby_engine[];
+
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/encoding.h
===================================================================
--- include/ruby/encoding.h	(revision 28708)
+++ include/ruby/encoding.h	(revision 28709)
@@ -22,6 +22,10 @@
 #include <stdarg.h>
 #include "ruby/oniguruma.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #define ENCODING_INLINE_MAX 1023
 #define ENCODING_SHIFT (FL_USHIFT+10)
 #define ENCODING_MASK (((VALUE)ENCODING_INLINE_MAX)<<ENCODING_SHIFT)
@@ -312,6 +316,10 @@
 #define ECONV_AFTER_OUTPUT                      0x00020000
 /* end of flags for rb_econv_convert */
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/oniguruma.h
===================================================================
--- include/ruby/oniguruma.h	(revision 28708)
+++ include/ruby/oniguruma.h	(revision 28709)
@@ -97,6 +97,10 @@
 #define ONIG_EXTERN   extern
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /* PART: character encoding */
 
 #ifndef ONIG_ESCAPE_UCHAR_COLLISION
@@ -789,6 +793,10 @@
 ONIG_EXTERN
 const char* onig_copyright P_((void));
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #ifdef __cplusplus
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/re.h
===================================================================
--- include/ruby/re.h	(revision 28708)
+++ include/ruby/re.h	(revision 28709)
@@ -24,6 +24,10 @@
 
 #include "ruby/regex.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 typedef struct re_pattern_buffer Regexp;
 
 struct rmatch_offset {
@@ -55,7 +59,12 @@
 long rb_reg_adjust_startpos(VALUE, VALUE, long, int);
 void rb_match_busy(VALUE);
 VALUE rb_reg_quote(VALUE);
+regex_t *rb_reg_prepare_re(VALUE re, VALUE str);
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/st.h
===================================================================
--- include/ruby/st.h	(revision 28708)
+++ include/ruby/st.h	(revision 28709)
@@ -33,6 +33,10 @@
 # include <inttypes.h>
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #if SIZEOF_LONG == SIZEOF_VOIDP
 typedef unsigned long st_data_t;
 #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
@@ -125,6 +129,10 @@
 st_index_t st_hash_start(st_index_t h);
 #define st_hash_start(h) ((st_index_t)(h))
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: include/ruby/io.h
===================================================================
--- include/ruby/io.h	(revision 28708)
+++ include/ruby/io.h	(revision 28709)
@@ -27,6 +27,10 @@
 #include <stdio_ext.h>
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 typedef struct rb_io_t {
     int fd;                     /* file descriptor */
     FILE *stdio_file;		/* stdio ptr for read/write if available */
@@ -165,6 +169,10 @@
 int rb_io_read_pending(rb_io_t*);
 DEPRECATED(void rb_read_check(FILE*));
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #if defined(__cplusplus)
 #if 0
 { /* satisfy cc-mode */
Index: configure.in
===================================================================
--- configure.in	(revision 28708)
+++ configure.in	(revision 28709)
@@ -269,6 +269,7 @@
     linker_flag=-Wl,
     : ${optflags=-O3}
     AS_CASE(["$target_os"], [linux*|darwin*], [: ${debugflags=-ggdb}])
+    RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
 else
     linker_flag=
 fi
@@ -414,6 +415,9 @@
                              [wflag=-Wall])
     RUBY_TRY_CFLAGS($wflag, [warnflags="$wflag${warnflags+ $warnflags}"])
 fi
+if test "$GCC" = yes; then
+    RUBY_TRY_CFLAGS(-fvisibility=hidden, RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden))
+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\""
@@ -2160,8 +2164,6 @@
 	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)'
-	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_*'
-	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*'
 	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 28708)
+++ ChangeLog	(revision 28709)
@@ -1,5 +1,7 @@
-Thu Jul 22 06:26:48 2010  Nobuyoshi Nakada  <nobu@r...>
+Thu Jul 22 06:38:18 2010  Nobuyoshi Nakada  <nobu@r...>
 
+	* configure.in (XCFLAGS): use -fvisibility=hidden if possible.
+
 	* configure.in (RMDIR): use --ignore-fail-on-non-empty if possible.
 
 	* configure.in (RUBY_EXTERN): FUNCTION-BODY was missing.
Index: regenc.h
===================================================================
--- regenc.h	(revision 28708)
+++ regenc.h	(revision 28709)
@@ -39,6 +39,10 @@
 #endif
 #include "ruby/oniguruma.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 typedef struct {
   OnigCodePoint from;
   OnigCodePoint to;
@@ -208,4 +212,8 @@
 #define ENC_ALIAS(name, orig)
 #define ENC_DUMMY(name)
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* ONIGURUMA_REGENC_H */
Index: iseq.h
===================================================================
--- iseq.h	(revision 28708)
+++ iseq.h	(revision 28709)
@@ -12,6 +12,10 @@
 #ifndef RUBY_COMPILE_H
 #define RUBY_COMPILE_H
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 /* compile.c */
 VALUE rb_iseq_compile_node(VALUE self, NODE *node);
 int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
@@ -101,4 +105,8 @@
 #define DEFINED_ZSUPER INT2FIX(9)
 #define DEFINED_FUNC   INT2FIX(10)
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* RUBY_COMPILE_H */
Index: common.mk
===================================================================
--- common.mk	(revision 28708)
+++ common.mk	(revision 28709)
@@ -680,6 +680,8 @@
   {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \
   {$(VPATH)}transcode_data.h {$(VPATH)}ruby.h {$(VPATH)}config.h
 
+$(OBJS):  {$(VPATH)}config.h {$(VPATH)}missing.h
+
 INSNS2VMOPT = --srcdir="$(srcdir)"
 
 {$(VPATH)}minsns.inc: $(srcdir)/template/minsns.inc.tmpl
Index: regint.h
===================================================================
--- regint.h	(revision 28708)
+++ regint.h	(revision 28709)
@@ -225,6 +225,10 @@
 
 #include "regenc.h"
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #ifdef MIN
 #undef MIN
 #endif
@@ -838,4 +842,8 @@
 
 extern int onigenc_property_list_init P_((ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE));
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* ONIGURUMA_REGINT_H */
Index: dln.h
===================================================================
--- dln.h	(revision 28708)
+++ dln.h	(revision 28709)
@@ -28,6 +28,10 @@
 # define _(args) ()
 #endif
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 DEPRECATED(char *dln_find_exe(const char*,const char*));
 DEPRECATED(char *dln_find_file(const char*,const char*));
 char *dln_find_exe_r(const char*,const char*,char*,size_t);
@@ -38,4 +42,9 @@
 #endif
 
 void *dln_load(const char*);
+
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
 #endif
+
+#endif
Index: cont.c
===================================================================
--- cont.c	(revision 28708)
+++ cont.c	(revision 28709)
@@ -1428,6 +1428,10 @@
     rb_define_method(rb_cFiber, "resume", rb_fiber_m_resume, -1);
 }
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 void
 ruby_Init_Continuation_body(void)
 {
@@ -1446,3 +1450,7 @@
     rb_define_method(rb_cFiber, "alive?", rb_fiber_alive_p, 0);
     rb_define_singleton_method(rb_cFiber, "current", rb_fiber_s_current, 0);
 }
+
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
Index: transcode_data.h
===================================================================
--- transcode_data.h	(revision 28708)
+++ transcode_data.h	(revision 28709)
@@ -14,6 +14,10 @@
 #ifndef RUBY_TRANSCODE_DATA_H
 #define RUBY_TRANSCODE_DATA_H 1
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
 #define WORDINDEX_SHIFT_BITS 2
 #define WORDINDEX2INFO(widx)      ((widx) << WORDINDEX_SHIFT_BITS)
 #define INFO2WORDINDEX(info)      ((info) >> WORDINDEX_SHIFT_BITS)
@@ -106,4 +110,8 @@
 void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);
 void rb_register_transcoder(const rb_transcoder *);
 
+#if defined __GNUC__ && __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
 #endif /* RUBY_TRANSCODE_DATA_H */

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

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