This patch completes my series of patches to move startup files etc. to
toplevel libgcc:

        http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00098.html
        http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02337.html

There are a few parts that require approval:

* The gcc/mkmap-flat.awk change needs either build or global reviewer
  approval.

* The libgcc/configure.ac change to determine target_thread_file and
  libgcc/config/alpha/t-crtfm use of $< may need build maintainer approval.

The only noteworthy change is the change to only export symbols from
libgcc_s.so.1 that are considered part of its interface.  While the
Tru64 UNIX linker doesn't support symbol versioning or even SGI ld's
-exported_symbols, it has -input which simply reads command line options
from a file.  I've therefore modified mkmap-flat.awk to conditionlly
emit -exported_symbol <symbol> if invoked with -v osf_export=1.  This
nicely hides several symbols.

A slightly earlier version has been bootstrapped without regressions on
alpha-dec-osf5.1b.

Ok for mainline after a fresh bootstrap?

Thanks.
        Rainer


2011-04-30  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        gcc:
        * config/alpha/t-osf5: Remove.
        * config/alpha/t-osf-pthread: Remove.
        * config.gcc (alpha*-dec-osf5.1*): Set tmake_file to t-slibgcc-dummy.
        * mkmap-flat.awk: Handle osf_export for Tru64 UNIX linker -input file.

        libgcc:
        * configure.ac (target_thread_file): Determine thread model.
        * configure: Regenerate.
        * config.host (alpha*-dec-osf5.1*): Set tmake_file, extra_parts.
        * config/alpha/t-alpha: New file.
        * config/alpha/t-crtfm: Use $<.
        * config/alpha/t-ieee: New file.
        * config/alpha/t-osf5: New file.
        * config/alpha/t-osf-pthread: New file.
        * config/alpha/t-slibgcc-osf: New file.
        * config/alpha/libgcc-osf5.ver: New file.

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -755,7 +755,7 @@ alpha*-dec-osf5.1*)
                extra_passes="mips-tfile mips-tdump"
        fi
        use_collect2=yes
-       tmake_file="alpha/t-alpha alpha/t-ieee alpha/t-crtfm alpha/t-osf5"
+       tmake_file="t-slibgcc-dummy"
        tm_file="${tm_file} alpha/osf5.h"
        tm_defines="${tm_defines} TARGET_SUPPORT_ARCH=1"
        extra_options="${extra_options} rpath.opt alpha/osf5.opt"
@@ -764,7 +764,6 @@ alpha*-dec-osf5.1*)
        case ${enable_threads} in
          "" | yes | posix)
            thread_file='posix'
-           tmake_file="${tmake_file} alpha/t-osf-pthread"
            ;;
        esac
        ;;
diff --git a/gcc/mkmap-flat.awk b/gcc/mkmap-flat.awk
--- a/gcc/mkmap-flat.awk
+++ b/gcc/mkmap-flat.awk
@@ -1,5 +1,5 @@
 # Generate a flat list of symbols to export.
-#      Copyright (C) 2007, 2008, 2009  Free Software Foundation, Inc.
+#      Copyright (C) 2007, 2008, 2009, 2011  Free Software Foundation, Inc.
 #      Contributed by Richard Henderson <r...@cygnus.com>
 #
 # This file is part of GCC.
@@ -20,6 +20,8 @@
 
 # Options:
 #   "-v leading_underscore=1" : Symbols in map need leading underscore.
+#   "-v osf_export=1"        : Create -input file for Tru64 UNIX linker
+#                              instead of map file.
 #   "-v pe_dll=1"             : Create .DEF file for Windows PECOFF
 #                               DLL link instead of map file.
 
@@ -98,6 +100,10 @@ END {
   }
 
   for (sym in export)
-    if (def[sym] || (pe_dll && def["_" sym]))
-      print sym;
+    if (def[sym] || (pe_dll && def["_" sym])) {
+      if (!osf_export)
+       print sym;
+      else
+       print "-exported_symbol " sym;
+    }
 }
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -218,6 +218,13 @@ alpha*-*-netbsd*)
 alpha*-*-openbsd*)
        ;;
 alpha*-dec-osf5.1*)
+       tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee alpha/t-crtfm 
t-slibgcc alpha/t-slibgcc-osf"
+       case ${target_thread_file} in
+         posix)
+           tmake_file="${tmake_file} alpha/t-osf-pthread"
+           ;;
+       esac
+       extra_parts="${extra_parts} qrnnd.o crtfastmath.o gthr-posix.o"
        ;;
 alpha64-dec-*vms*)
        tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms"
diff --git a/libgcc/config/alpha/libgcc-osf5.ver 
b/libgcc/config/alpha/libgcc-osf5.ver
new file mode 100644
--- /dev/null
+++ b/libgcc/config/alpha/libgcc-osf5.ver
@@ -0,0 +1,58 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Tru64 UNIX specific additions to libgcc-std.ver.
+
+GCC_4.7.0 {
+  __udiv_qrnnd
+  # Beware *not* to hide the POSIX threads related symbols provided by
+  # gthr-posix.c, as this would prevent their preemption by real symbols.
+  __pthread_cancel
+  __pthread_cond_broadcast
+  __pthread_cond_destroy
+  __pthread_cond_init
+  __pthread_cond_signal
+  __pthread_cond_timedwait
+  __pthread_cond_wait
+  __pthread_create
+  __pthread_detach
+  __pthread_exit
+  __pthread_getspecific
+  __pthread_join
+  __pthread_mutex_destroy
+  __pthread_mutex_init
+  __pthread_mutex_lock
+  __pthread_mutex_trylock
+  __pthread_mutex_unlock
+  __pthread_once
+  __pthread_self
+  __pthread_setspecific
+  pthread_attr_destroy
+  pthread_attr_init
+  pthread_attr_setdetachstate
+  pthread_getschedparam
+  pthread_key_create
+  pthread_key_delete
+  pthread_mutexattr_destroy
+  pthread_mutexattr_init
+  pthread_mutexattr_settype
+  pthread_setschedparam
+  sched_get_priority_max
+  sched_get_priority_min
+  sched_yield
+}
diff --git a/gcc/config/alpha/t-alpha b/libgcc/config/alpha/t-alpha
copy from gcc/config/alpha/t-alpha
copy to libgcc/config/alpha/t-alpha
--- a/gcc/config/alpha/t-alpha
+++ b/libgcc/config/alpha/t-alpha
@@ -1,2 +1,2 @@
 # This is a support routine for longlong.h, used by libgcc2.c.
-LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/qrnnd.asm
+LIB2ADD += $(gcc_srcdir)/config/alpha/qrnnd.asm
diff --git a/libgcc/config/alpha/t-crtfm b/libgcc/config/alpha/t-crtfm
--- a/libgcc/config/alpha/t-crtfm
+++ b/libgcc/config/alpha/t-crtfm
@@ -2,5 +2,4 @@
 # while migrating this rule from the GCC directory, but I do not
 # know why it is necessary if no other crt file uses it.
 crtfastmath.o: $(gcc_srcdir)/config/alpha/crtfastmath.c
-       $(gcc_compile) -frandom-seed=gcc-crtfastmath -c \
-               $(gcc_srcdir)/config/alpha/crtfastmath.c
+       $(gcc_compile) -frandom-seed=gcc-crtfastmath -c $<
diff --git a/gcc/config/alpha/t-ieee b/libgcc/config/alpha/t-ieee
copy from gcc/config/alpha/t-ieee
copy to libgcc/config/alpha/t-ieee
--- a/gcc/config/alpha/t-ieee
+++ b/libgcc/config/alpha/t-ieee
@@ -1,2 +1,2 @@
 # All alphas get an IEEE complaint set of libraries.
-TARGET_LIBGCC2_CFLAGS += -mieee
+HOST_LIBGCC2_CFLAGS += -mieee
diff --git a/gcc/config/alpha/t-osf-pthread b/libgcc/config/alpha/t-osf-pthread
rename from gcc/config/alpha/t-osf-pthread
rename to libgcc/config/alpha/t-osf-pthread
--- a/gcc/config/alpha/t-osf-pthread
+++ b/libgcc/config/alpha/t-osf-pthread
@@ -1,5 +1,5 @@
+# Compile libgcc2 with POSIX threads supports
+HOST_LIBGCC2_CFLAGS += -pthread
+
 # Provide dummy POSIX threads functions
-LIB2FUNCS_EXTRA += $(srcdir)/gthr-posix.c
-
-# Compile libgcc2 with POSIX threads supports
-TARGET_LIBGCC2_CFLAGS=-pthread
+LIB2ADD += $(gcc_srcdir)/gthr-posix.c
diff --git a/gcc/config/alpha/t-osf5 b/libgcc/config/alpha/t-slibgcc-osf
rename from gcc/config/alpha/t-osf5
rename to libgcc/config/alpha/t-slibgcc-osf
--- a/gcc/config/alpha/t-osf5
+++ b/libgcc/config/alpha/t-slibgcc-osf
@@ -1,4 +1,5 @@
-# Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2011
+# Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -16,33 +17,13 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
+# Build a shared libgcc library with the Tru64 UNIX linker.
 
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
+SHLIB_LDFLAGS = -Wl,-msym -Wl,-set_version,gcc.1 -Wl,-soname,$(SHLIB_SONAME) \
+       -Wl,-hidden -Wl,-input,$(SHLIB_MAP)
 
-# Build a shared libgcc library.
-SHLIB_EXT = .so
-SHLIB_NAME = @shlib_base_name@.so
-SHLIB_SONAME = @shlib_base_name@.so.1
-SHLIB_OBJS = @shlib_objs@
-
-# Beware *not* to hide the POSIX threads related symbols provided by
-# gthr-posix.c, as this would prevent their preemption by real symbols.
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-       -Wl,-msym -Wl,-set_version,gcc.1 -Wl,-soname,$(SHLIB_SONAME) \
-       -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \
-       rm -f $(SHLIB_SONAME) && \
-       if [ -f $(SHLIB_NAME) ]; then \
-         mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \
-       else true; fi && \
-       mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \
-       $(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-       $$(mkinstalldirs) $$(DESTDIR)$$(slibdir); \
-       $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(slibdir)/$(SHLIB_SONAME); \
-       rm -f $$(DESTDIR)$$(slibdir)/$(SHLIB_NAME); \
-       $(LN_S) $(SHLIB_SONAME) $$(DESTDIR)$$(slibdir)/$(SHLIB_NAME)
+SHLIB_MKMAP = $(gcc_srcdir)/mkmap-flat.awk
+SHLIB_MKMAP_OPTS = -v osf_export=1
+# Needed so mkmap-flat.awk can parse the nm output.
+SHLIB_NM_FLAGS = -Bg
+SHLIB_MAPFILES = $(gcc_srcdir)/libgcc-std.ver 
$(srcdir)/config/alpha/libgcc-osf5.ver
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -169,6 +169,10 @@ AC_SUBST(fixed_point)
 
 AC_LIB_PROG_LD_GNU
 
+AC_MSG_CHECKING([for thread model used by GCC])
+target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+AC_MSG_RESULT([$target_thread_file]) 
+
 # Check for assembler CFI support.
 AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],
               [AC_COMPILE_IFELSE(

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to