diff options
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/Makefile.in | 14 | ||||
-rw-r--r-- | gcc/config/ia64/libgcc-ia64.ver | 8 | ||||
-rw-r--r-- | gcc/config/ia64/t-ia64 | 2 | ||||
-rw-r--r-- | gcc/config/libgcc-glibc.ver | 23 | ||||
-rw-r--r-- | gcc/config/mips/t-iris6 | 6 | ||||
-rw-r--r-- | gcc/config/sparc/t-sol2 | 5 | ||||
-rw-r--r-- | gcc/config/t-linux | 10 | ||||
-rw-r--r-- | gcc/libgcc-std.ver | 129 | ||||
-rw-r--r-- | gcc/mklibgcc.in | 24 | ||||
-rw-r--r-- | gcc/mkmap-flat.awk | 78 | ||||
-rw-r--r-- | gcc/mkmap-symver.awk | 101 |
12 files changed, 411 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1bb180bab2..88c612020d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,24 @@ 2000-10-05 Richard Henderson <rth@cygnus.com> + * Makefile.in (NM_FOR_TARGET): New. + (libgcc.mk): Pass SHLIB_MKMAP, SHLIB_MAPFILES. + (libgcc.a, stmp-multilib): Pass NM_FOR_TARGET. + * mklibgcc.in: If SHLIB_MKMAP, build libgcc.map. Depend the + shared library build on that and EXTRA_MULTILIB_PARTS. + * mkmap-flat.awk: New file. + * mkmap-symver.awk: New file. + * libgcc-std.ver: New file. + * config/libgcc-glibc.ver: New file. + * config/ia64/libgcc-ia64.ver: New file. + * config/t-linux (SHLIB_MKMAP, SHLIB_MAPFILES): New. + (SHLIB_LINK): Add --version-script. + * config/ia64/t-ia64 (SHLIB_MAPFILES): Add libgcc-ia64.ver. + * config/mips/t-iris6 (SHLIB_MKMAP, SHLIB_MAPFILES): New. + * config/sparc/t-sol2 (SHLIB_MKMAP, SHLIB_MAPFILES): New. + (SHLIB_LINK): Add -M. + +2000-10-05 Richard Henderson <rth@cygnus.com> + * Makefile.in (LIB2FUNCS): Add _clz. * libgcc2.c (__ffsdi2): Use count_trailing_zeros. (__clz_tab): Put in its own unit, non-static. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 669a8ff37b2..4fa487ca986 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -221,6 +221,16 @@ RANLIB_TEST_FOR_TARGET = \ [ -f $(RANLIB_FOR_TARGET) ] \ || ( [ "$(host_canonical)" = "$(target)" ] \ && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ) +NM_FOR_TARGET = ` \ + if [ -f $(objdir)/../binutils/nm ] ; then \ + echo $(objdir)/../binutils/nm ; \ + else \ + if [ "$(host_canonical)" = "$(target)" ] ; then \ + echo nm; \ + else \ + t='$(program_transform_cross_name)'; echo nm | sed -e $$t ; \ + fi; \ + fi` # Dir to search for system headers. Overridden by cross-make. SYSTEM_HEADER_DIR = /usr/include @@ -972,6 +982,8 @@ libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) xgcc$(exeext) SHLIB_LINK='$(SHLIB_LINK)' \ SHLIB_LIBS='$(SHLIB_LIBS)' \ SHLIB_MULTILIB='$(SHLIB_MULTILIB)' \ + SHLIB_MKMAP='$(SHLIB_MKMAP)' \ + SHLIB_MAPFILES='$(SHLIB_MAPFILES)' \ $(SHELL) mklibgcc > tmp-libgcc.mk mv tmp-libgcc.mk libgcc.mk @@ -991,6 +1003,7 @@ libgcc.a: $(LIBGCC_DEPS) CFLAGS="$(CFLAGS) $(WARN_CFLAGS)" \ RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ + NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \ LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \ INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \ CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \ @@ -1023,6 +1036,7 @@ stmp-multilib: $(LIBGCC_DEPS) CFLAGS="$(CFLAGS) $(WARN_CFLAGS)" \ RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ + NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \ LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \ INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \ CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \ diff --git a/gcc/config/ia64/libgcc-ia64.ver b/gcc/config/ia64/libgcc-ia64.ver new file mode 100644 index 00000000000..a03799f0d09 --- /dev/null +++ b/gcc/config/ia64/libgcc-ia64.ver @@ -0,0 +1,8 @@ +GCC_3.0 { + # IA-64 symbols + __ia64_nonlocal_goto + __ia64_personality_v1 + __ia64_restore_stack_nonlocal + __ia64_save_stack_nonlocal + __ia64_trampoline +} diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64 index 1f1e61af5c9..f27c72957d0 100644 --- a/gcc/config/ia64/t-ia64 +++ b/gcc/config/ia64/t-ia64 @@ -20,6 +20,8 @@ LIB1ASMFUNCS = __divtf3 __divdf3 __divsf3 \ # to support the Intel assembler. #LIBGCC2_DEBUG_CFLAGS = -g1 -P +SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64.ver + # For svr4 we build crtbegin.o and crtend.o which serve to add begin and # end labels to the .ctors and .dtors section when we link using gcc. diff --git a/gcc/config/libgcc-glibc.ver b/gcc/config/libgcc-glibc.ver new file mode 100644 index 00000000000..837c1a7ee56 --- /dev/null +++ b/gcc/config/libgcc-glibc.ver @@ -0,0 +1,23 @@ +# In order to work around the very problems that force us to now generally +# create a libgcc.so, glibc reexported a number of routines from libgcc.a. +# By now choosing the same version tags for these specific routines, we +# maintain enough binary compatibility to allow future versions of glibc +# to defer implementation of these routines to libgcc.so via DT_AUXILIARY. + +%inherit GCC_3.0 GLIBC_2.0 +GLIBC_2.0 { + # Sampling of DImode arithmetic used by (at least) i386 and m68k. + __divdi3 + __moddi3 + __udivdi3 + __umoddi3 + + # Exception handling support functions used by most everyone. + __register_frame + __register_frame_table + __deregister_frame + __register_frame_info + __deregister_frame_info + __frame_state_for + __register_frame_info_table +} diff --git a/gcc/config/mips/t-iris6 b/gcc/config/mips/t-iris6 index 7cc82dad0c7..24e385d4606 100644 --- a/gcc/config/mips/t-iris6 +++ b/gcc/config/mips/t-iris6 @@ -22,4 +22,10 @@ CRTSTUFF_T_CFLAGS=-g1 # Build a shared libgcc library. SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ -Wl,-soname,@shlib_base_name@.so.0 +# ??? Irix 6.5 seems to eat the option fine (if we somehow remove the +# -hidden_symbol option, which is documented to be ignored in conjunction +# with -exports_file), but fails to actually hide any symbols. +# -Wl,-exports_file,libgcc.map SHLIB_LIBS = -lc +SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk +SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver diff --git a/gcc/config/sparc/t-sol2 b/gcc/config/sparc/t-sol2 index 6ac994e3b5d..7a44631429b 100644 --- a/gcc/config/sparc/t-sol2 +++ b/gcc/config/sparc/t-sol2 @@ -31,5 +31,8 @@ TARGET_LIBGCC2_CFLAGS = -fPIC # Build a shared libgcc library. SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,-h,@shlib_base_name@.so.0 -Wl,-z,text -Wl,-z,defs + -Wl,-h,@shlib_base_name@.so.0 -Wl,-z,text -Wl,-z,defs \ + -Wl,-M,libgcc.map SHLIB_LIBS = -lc +SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk +SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver diff --git a/gcc/config/t-linux b/gcc/config/t-linux index 966ae810693..858faa9619c 100644 --- a/gcc/config/t-linux +++ b/gcc/config/t-linux @@ -10,14 +10,14 @@ CRTSTUFF_T_CFLAGS_S = -fPIC TARGET_LIBGCC2_CFLAGS = -fPIC # Build a shared libgcc library. SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ - -Wl,--soname=@shlib_base_name@.so.0 -# ??? Do versioning later -- need to figure out how to post-process -# the script and allow for target-specific additions. -# -Wl,--version-script=$(srcdir)/config/ver-glibc.map + -Wl,--soname=@shlib_base_name@.so.0 \ + -Wl,--version-script=libgcc.map SHLIB_LIBS = -lc +SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk +SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/libgcc-glibc.ver # Do not build libgcc1. Let gcc generate those functions. The GNU/Linux # C library can handle them. -LIBGCC1 = +LIBGCC1 = CROSS_LIBGCC1 = LIBGCC1_TEST = diff --git a/gcc/libgcc-std.ver b/gcc/libgcc-std.ver new file mode 100644 index 00000000000..b3bf25fcbf6 --- /dev/null +++ b/gcc/libgcc-std.ver @@ -0,0 +1,129 @@ +GCC_3.0 { + # libgcc1 symbols + __adddf3 + __addsf3 + __ashlsi3 + __ashrsi3 + __divdf3 + __divsf3 + __divsi3 + __divtf3 + __eqdf2 + __eqsf2 + __extendsfdf2 + __fixdfsi + __fixsfsi + __floatsidf + __floatsisf + __gedf2 + __gesf2 + __gtdf2 + __gtsf2 + __ledf2 + __lesf2 + __lshrsi3 + __ltdf2 + __ltsf2 + __modsi3 + __muldf3 + __mulsf3 + __mulsi3 + __nedf2 + __negdf2 + __negsf2 + __nesf2 + __subdf3 + __subsf3 + __truncdfsf2 + __udivsi3 + __umodsi3 + + # libgcc2 DImode arithmetic (for 32-bit targets). + __ashldi3 + __ashrdi3 + __cmpdi2 + __divdi3 + __ffsdi2 + __fixdfdi + __fixsfdi + __fixunsdfdi + __fixunssfdi + __floatdidf + __floatdisf + __lshrdi3 + __moddi3 + __muldi3 + __negdi2 + __ucmpdi2 + __udivdi3 + __udivmoddi4 + __umoddi3 + + # libgcc2 TImode arithmetic (for 64-bit targets). + __ashlti3 + __ashrti3 + __cmpti2 + __divti3 + __ffsti2 + __fixdfti + __fixsfti + __lshrti3 + __modti3 + __multi3 + __negti2 + __ucmpti2 + __udivmodti4 + __udivti3 + __umodti3 + __fixunsdfti + __fixunssfti + __floattidf + __floattisf + __fixtfti + __fixunstfti + __floattitf + + # Basic block profile symbols. + # ??? Some of these are for `-a', which ought to die. + __bb + __bb_exit_func + __bb_fork_func + __bb_init_func + __bb_init_trace_func + __bb_trace_func + __bb_trace_ret + + # ??? Symbols that perhaps unused should be nuked. + __builtin_saveregs + __clear_cache + __dummy + __empty + __eprintf + __gcc_bcmp + __shtab + + # EH symbols + __default_terminate + __deregister_frame + __deregister_frame_info + __eh_alloc + __eh_free + __eh_rtime_match + __frame_state_for + __get_dynamic_handler_chain + __get_eh_context + __get_eh_info + __get_eh_table_language + __get_eh_table_version + __register_frame + __register_frame_info + __register_frame_info_table + __register_frame_table + __rethrow + __sjpopnthrow + __sjthrow + __terminate + __throw + __throw_type_match + __unwinding_cleanup +} diff --git a/gcc/mklibgcc.in b/gcc/mklibgcc.in index 54dcf2b848c..43dac4f75b3 100644 --- a/gcc/mklibgcc.in +++ b/gcc/mklibgcc.in @@ -26,6 +26,8 @@ # SHLIB_LINK # SHLIB_LIBS # SHLIB_MULTILIB +# SHLIB_MKMAP +# SHLIB_MAPFILES # Make needs VPATH to be literal. echo 'srcdir = @srcdir@' @@ -263,6 +265,8 @@ for file in $LIB2ADD; do fi done +# SHLIB_MKMAP +# SHLIB_MAPFILES for ml in $MULTILIBS; do dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'` flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; @@ -278,6 +282,22 @@ for ml in $MULTILIBS; do for o in $libgcc2_objs; do libgcc_objs="$libgcc_objs libgcc/${dir}/$o" done + shlib_deps="$libgcc_objs" + + if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" -a -z "$mapfile" ]; then + mapfile="libgcc.map" + shlib_deps="$shlib_deps $mapfile" + echo "" + echo "${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_objs" + echo ' { $(NM_FOR_TARGET) -pg'" $libgcc_objs; echo %%; cat $SHLIB_MAPFILES; } | "'$(AWK)'" -f $SHLIB_MKMAP > "'tmp-$@' + echo ' mv tmp-$@ $@' + fi + + # Depend on EXTRA_MULTILIB_PARTS, since that's where crtbegin/end + # usually are put in a true multilib situation. + for f in $EXTRA_MULTILIB_PARTS; do + shlib_deps="$shlib_deps $dir/$f" + done echo "" echo "${dir}/libgcc.a: $libgcc_objs" @@ -295,12 +315,12 @@ for ml in $MULTILIBS; do shlib_base_name=libgcc_s_`echo $dir | sed s,/,_,g` fi echo "" - echo "${dir}/${shlib_base_name}.so: $libgcc_objs" + echo "${dir}/${shlib_base_name}.so: $shlib_deps" echo " $SHLIB_LINK $flags -o ${shlib_base_name}.so $libgcc_objs $SHLIB_LIBS" | sed "s/@shlib_base_name@/$shlib_base_name/g" elif [ "$SHLIB_MULTILIB" = "$dir" ]; then shlib_base_name="libgcc_s"; echo "" - echo "${shlib_base_name}.so: $libgcc_objs" + echo "${shlib_base_name}.so: $shlib_deps" echo " $SHLIB_LINK $flags -o ${shlib_base_name}.so $libgcc_objs $SHLIB_LIBS" | sed "s/@shlib_base_name@/$shlib_base_name/g" fi fi diff --git a/gcc/mkmap-flat.awk b/gcc/mkmap-flat.awk new file mode 100644 index 00000000000..de22d7c33e1 --- /dev/null +++ b/gcc/mkmap-flat.awk @@ -0,0 +1,78 @@ +# Generate a flat list of symbols to export. +# Contributed by Richard Henderson <rth@cygnus.com> +# +# This file is part of GNU CC. +# +# GNU CC 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 2, or (at your option) +# any later version. +# +# GNU CC 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 GNU CC; see the file COPYING. If not, write to +# the Free Software Foundation, 59 Temple Place - Suite 330, +# Boston MA 02111-1307, USA. + +BEGIN { + state = "nm"; +} + +# Remove comment and blank lines. +/^ *#/ || /^ *$/ { + next; +} + +# We begin with nm input. Collect the set of symbols that are present +# so that we can elide undefined symbols. + +state == "nm" && /^%%/ { + state = "ver"; + next; +} + +state == "nm" && ($1 == "U" || $2 == "U") { + next; +} + +state == "nm" && NF == 3 { + def[$3] = 1; + next; +} + +state == "nm" { + next; +} + +# Now we process a simplified variant of the Solaris symbol version +# script. We have one symbol per line, no semicolons, simple markers +# for beginning and ending each section, and %inherit markers for +# describing version inheritence. A symbol may appear in more than +# one symbol version, and the last seen takes effect. + +NF == 3 && $1 == "%inherit" { + next; +} + +NF == 2 && $2 == "{" { + next; +} + +$1 == "}" { + next; +} + +{ + export[$1] = 1; + next; +} + +END { + for (sym in export) + if (def[sym]) + print sym; +} diff --git a/gcc/mkmap-symver.awk b/gcc/mkmap-symver.awk new file mode 100644 index 00000000000..5ea676923fe --- /dev/null +++ b/gcc/mkmap-symver.awk @@ -0,0 +1,101 @@ +# Generate an ELF symbol version map a-la Solaris and GNU ld. +# Contributed by Richard Henderson <rth@cygnus.com> +# +# This file is part of GNU CC. +# +# GNU CC 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 2, or (at your option) +# any later version. +# +# GNU CC 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 GNU CC; see the file COPYING. If not, write to +# the Free Software Foundation, 59 Temple Place - Suite 330, +# Boston MA 02111-1307, USA. + +BEGIN { + state = "nm"; +} + +# Remove comment and blank lines. +/^ *#/ || /^ *$/ { + next; +} + +# We begin with nm input. Collect the set of symbols that are present +# so that we can not emit them into the final version script -- Solaris +# complains at us if we do. + +state == "nm" && /^%%/ { + state = "ver"; + next; +} + +state == "nm" && ($1 == "U" || $2 == "U") { + next; +} + +state == "nm" && NF == 3 { + def[$3] = 1; + next; +} + +state == "nm" { + next; +} + +# Now we process a simplified variant of the Solaris symbol version +# script. We have one symbol per line, no semicolons, simple markers +# for beginning and ending each section, and %inherit markers for +# describing version inheritence. A symbol may appear in more than +# one symbol version, and the last seen takes effect. + +NF == 3 && $1 == "%inherit" { + inherit[$2] = $3; + next; +} + +NF == 2 && $2 == "{" { + libs[$1] = 1; + thislib = $1; + next; +} + +$1 == "}" { + thislib = ""; + next; +} + +{ + ver[$1] = thislib; + next; +} + +END { + for (l in libs) + output(l); +} + +function output(lib) { + if (done[lib]) + return; + done[lib] = 1; + if (inherit[lib]) + output(inherit[lib]); + + printf("%s {\n", lib); + printf(" global:\n"); + for (sym in ver) + if ((ver[sym] == lib) && (sym in def)) + printf("\t%s;\n", sym); + + if (inherit[lib]) + printf("} %s;\n", inherit[lib]); + else + printf ("\n local:\n\t*;\n};\n"); +} |