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
This commit is contained in:
nobu 2015-02-23 07:05:23 +00:00
Родитель 0eb1ac5b39
Коммит 556515bf69
4 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -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}' \

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)'

Просмотреть файл

@ -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