From 05392588e83e85b91549fad1fb00408497b8c019 Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 28 Jan 2009 11:08:44 +0000 Subject: merges r21685 from trunk into ruby_1_9_1. * Makefile.in (miniruby): renames and then removes, to get rid of EPERM on cygwin and mingw. * Makefile.in ($(LIBRUBY_SO)): use wildcard option of objcopy. * configure.in (DLDFLAGS): do not export all symbols. * cygwin/GNUmakefile.in (RUBYDEF): rejects symbols prefixex with Init_. * win32/mkexports.rb (Exports::Mingw): includes all symbols except for prefixed with Init_ as well as mswin32. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 15 +++++++++++++++ Makefile.in | 6 ++---- configure.in | 3 ++- cygwin/GNUmakefile.in | 19 +++++++++++-------- win32/mkexports.rb | 6 +----- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 876e1e1883..c5ebae7217 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Tue Jan 20 15:32:29 2009 Nobuyoshi Nakada + + * Makefile.in (miniruby): renames and then removes, to get rid of + EPERM on cygwin and mingw. + + * Makefile.in ($(LIBRUBY_SO)): use wildcard option of objcopy. + + * configure.in (DLDFLAGS): do not export all symbols. + + * cygwin/GNUmakefile.in (RUBYDEF): rejects symbols prefixex with + Init_. + + * win32/mkexports.rb (Exports::Mingw): includes all symbols except for + prefixed with Init_ as well as mswin32. + Wed Jan 28 15:24:11 2009 TAKANO Mitsuhiro (takano32) * math.c: SEGV is caused by implicit rb_to_float declaration diff --git a/Makefile.in b/Makefile.in index f4a4f785db..df308004a2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -125,7 +125,7 @@ all: .NOEXPORT: miniruby$(EXEEXT): - @$(RM) $@ + @-if test -f $@; then mv -f $@ $@.old; $(RM) $@.old; fi $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE) $(LIBS) $(OUTFLAG)$@ $(PROGRAM): @@ -143,9 +143,7 @@ $(LIBRUBY_A): $(LIBRUBY_SO): @-$(PRE_LIBRUBY_UPDATE) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@ - @-test "$(OBJDUMP)" = "" || test "$(OBJCOPY)" = "" || { \ - set dummy `$(OBJDUMP) -t $@ | sed '/^[^ ]* g/!d;s/.* //;/^\(Init_\|vm_\)/!d;s/^/-L /'`; \ - shift; test "$$#" = 0 || $(OBJCOPY) "$$@" $@; } + -$(OBJCOPY) -w -L '@EXPORT_PREFIX@Init_*' $@ @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \ File.symlink "$(LIBRUBY_SO)", link}' \ $(LIBRUBY_ALIASES) || true diff --git a/configure.in b/configure.in index dbb2451a68..8dc2938b97 100644 --- a/configure.in +++ b/configure.in @@ -1463,7 +1463,7 @@ if test "$with_dln_a_out" != yes; then rb_cv_dlopen=yes;; cygwin*|mingw*) : ${LDSHARED="${CC} -shared "'$(if $(filter-out -g -g0,$(debugflags)),,-s)'} XLDFLAGS="$XLDFLAGS -Wl,--stack,0x00200000,--enable-auto-import" - DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import,--export-all" + DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import" : ${LIBPATHENV=""} rb_cv_dlopen=yes ;; hiuxmpp) : ${LDSHARED='ld -r'} ;; @@ -1856,6 +1856,7 @@ case "$target_os" in cygwin*) if test x"$enable_shared" = xyes; then LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}${TEENY}.dll + LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)' fi ;; mingw*) diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in index 91a5e73c88..9a0601d264 100644 --- a/cygwin/GNUmakefile.in +++ b/cygwin/GNUmakefile.in @@ -5,7 +5,7 @@ ENABLE_SHARED=@ENABLE_SHARED@ DLLWRAP = @DLLWRAP@ --target=@target_os@ ifeq (@target_os@,cygwin) - DLL_BASE_NAME := $(subst .dll,,$(LIBRUBY_SO)) + DLL_BASE_NAME := $(LIBRUBY_SO:.dll=) else DLL_BASE_NAME := $(RUBY_SO_NAME) DLLWRAP += -mno-cygwin @@ -29,7 +29,7 @@ WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT) SOLIBS := $(DLL_BASE_NAME).res.@OBJEXT@ $(SOLIBS) EXTOBJS += $(if $(filter-out $(RUBYW_INSTALL_NAME),$(@:$(EXEEXT)=)),$(RUBY_INSTALL_NAME),$(@:$(EXEEXT)=)).res.$(OBJEXT) RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc -RUBYDEF = $(RUBY_SO_NAME).def +RUBYDEF = $(DLL_BASE_NAME).def ruby: $(PROGRAM) rubyw: $(WPROGRAM) @@ -63,22 +63,25 @@ GNUmakefile: $(srcdir)/cygwin/GNUmakefile.in ifeq (@target_os@,mingw32) $(OBJS) $(MAINOBJ): win32.h +endif $(LIBRUBY_SO): $(RUBYDEF) $(RUBYDEF): $(LIBRUBY_A) $(PREP) $(RBCONFIG) +ifeq (@target_os@,cygwin) + @NM@ --extern --defined $(LIBRUBY_A) | \ + $(MINIRUBY) -n -e 'BEGIN{puts "VERSION $(MAJOR).$(MINOR)","EXPORTS"}' \ + -e 'puts $$1 if / [CDT] _((?!Init_).*)$$/' > $@ +else $(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A) +endif clean-local:: @$(RM) $(RUBYDEF) -endif ifeq (@target_os@,cygwin) -cygwin-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)$(TEENY).dll: $(LIBRUBY_A) - @NM@ --extern --defined $(LIBRUBY_A) | \ - $(MINIRUBY) -ne 'BEGIN{puts "VERSION $(MAJOR).$(MINOR)","EXPORTS"}; puts $$1+"=$(@F)."+$$1 if / [CDT] _(.*)$$/' >rubydll.def - @DLLWRAP@ -s --def=rubydll.def -o $@ - @rm -f rubydll.def +cygwin-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)$(TEENY).dll: $(LIBRUBY_A) $(RUBYDEF) + @DLLWRAP@ -s --def=$(RUBYDEF) -o $@ endif clean-local:: diff --git a/win32/mkexports.rb b/win32/mkexports.rb index cd88e968a5..966b602f97 100755 --- a/win32/mkexports.rb +++ b/win32/mkexports.rb @@ -143,15 +143,11 @@ class Exports::Mingw < Exports def each_export(objs) objdump(objs) do |l| - yield $1 if / [[:upper:]] _(.*)$/ =~ l + yield $1 if / [[:upper:]] _((?!Init_).*)$/ =~ l end yield "strcasecmp", "_stricmp" yield "strncasecmp", "_strnicmp" end - - def symbols() - @syms.select {|k, v| v}.sort.collect {|k, v| "#{k}=#{v}"} - end end END { -- cgit v1.2.3