summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-23 07:05:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-23 07:05:23 +0000
commit556515bf69a098c146b7856395a0e804e9159115 (patch)
tree45f6368183ace58d46e8f1faeac592e525cac0cf
parent0eb1ac5b392b082606b3a658fbc2cc7eaf76e0d3 (diff)
Makefile.in: make static IDs symbols local
* Makefile.in (LIBRUBY_SO): make symbols for static IDs which begin with ruby_static_id_ local too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--Makefile.in3
-rw-r--r--common.mk2
-rw-r--r--configure.in1
-rwxr-xr-xwin32/mkexports.rb6
4 files changed, 8 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index bb25f3e4f7..7fb19ded12 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -239,7 +239,8 @@ $(LIBRUBY_SO):
@-$(PRE_LIBRUBY_UPDATE)
$(ECHO) linking shared-library $@
$(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(EXTSOLIBS) $(OUTFLAG)$@
- -$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)*_threadptr_*' $@
+ -$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)ruby_static_id_*' \
+ -L '$(SYMBOL_PREFIX)*_threadptr_*' $@
$(Q) $(POSTLINK)
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link rescue nil; \
File.symlink "$(LIBRUBY_SO)", link}' \
diff --git a/common.mk b/common.mk
index d99b4bc3db..0cc381d649 100644
--- a/common.mk
+++ b/common.mk
@@ -234,7 +234,7 @@ $(STATIC_RUBY)$(EXEEXT): $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
ruby.imp: $(COMMONOBJS)
$(Q)$(NM) -Pgp $(COMMONOBJS) | \
- awk 'BEGIN{print "#!"}; $$2~/^[BDT]$$/&&$$1!~/^(Init_|.*_threadptr_|\.)/{print $$1}' | \
+ awk 'BEGIN{print "#!"}; $$2~/^[BDT]$$/&&$$1!~/^(Init_|ruby_static_id_|.*_threadptr_|\.)/{print $$1}' | \
sort -u -o $@
install: install-$(INSTALLDOC)
diff --git a/configure.in b/configure.in
index 45d8dd212b..3fe2a473c2 100644
--- a/configure.in
+++ b/configure.in
@@ -3516,6 +3516,7 @@ AS_CASE("$enable_shared", [yes], [
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,_ruby_static_id_*'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*'
fi
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)'
diff --git a/win32/mkexports.rb b/win32/mkexports.rb
index ab29fc1cfa..c3514f13ab 100755
--- a/win32/mkexports.rb
+++ b/win32/mkexports.rb
@@ -7,6 +7,8 @@ module RbConfig
end
class Exports
+ PrivateNames = /(?:Init_|ruby_static_id_|.*_threadptr_|DllMain\b)/
+
@@subclass = []
def self.inherited(klass)
@@subclass << [/#{klass.name.sub(/.*::/, '').downcase}/i, klass]
@@ -116,7 +118,7 @@ class Exports::Mswin < Exports
is_data = !$1
if noprefix or /^[@_]/ =~ l
next if /(?!^)@.*@/ =~ l || /@[[:xdigit:]]{8,32}$/ =~ l ||
- /^_?(?:Init_|.*_threadptr_|DllMain\b)/ =~ l
+ /^_?#{PrivateNames}/o =~ l
l.sub!(/^[@_]/, '') if /@\d+$/ !~ l
elsif !l.sub!(/^(\S+) \([^@?\`\']*\)$/, '\1')
next
@@ -150,7 +152,7 @@ class Exports::Cygwin < Exports
def each_export(objs)
symprefix = RbConfig::CONFIG["SYMBOL_PREFIX"]
symprefix.strip! if symprefix
- re = /\s(?:(T)|[[:upper:]])\s#{symprefix}((?!Init_|.*_threadptr_|DllMain\b).*)$/
+ re = /\s(?:(T)|[[:upper:]])\s#{symprefix}((?!#{PrivateNames}).*)$/
objdump(objs) do |l|
next if /@.*@/ =~ l
yield $2, !$1 if re =~ l