It occurred to me to do another test, building libgcc with and without the patch and comparing the binaries. That showed a problem - if there are multiple version files, their order matters. In all cases where $$(libgcc_objdir)/libgcc-std.ver occurs, it occurs first, so I've changed the order in srcdirify to match. I also need to properly svn rm the old libgcc-std.ver file.
Will check this in today after a bootstrap unless there are objections. Bernd
Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 174276) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2011-05-26 Bernd Schmidt <ber...@codesourcery.com> + + * Makefile.in (srcdirify): Change order so that libgcc_objdir is + substituted first. + * libgcc-std.ver: Delete file. + 2011-05-26 Jakub Jelinek <ja...@redhat.com> PR c++/49165 Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 174276) +++ gcc/Makefile.in (working copy) @@ -1894,13 +1894,15 @@ cc1$(exeext): $(C_OBJS) cc1-checksum.o $ LIB2ADD = $(LIB2FUNCS_EXTRA) LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA) -# All source files for libgcc are either in the source directory (in -# which case they will start with $(srcdir)), or generated into the build -# directory (in which case they will be relative paths). -srcdirify = $(patsubst $(srcdir)%,$$(gcc_srcdir)%,$(filter $(srcdir)%,$(1))) \ - $(patsubst $$(libgcc_objdir)/%,%, \ +# All source files for libgcc are either generated in the libgcc build +# directory which will be substituted for $$(libgcc_objdir), in the +# source directory (in which case they will start with $(srcdir)), or +# generated into the build directory (in which case they will be +# relative paths). +srcdirify = $(patsubst $$(libgcc_objdir)/%,%, \ $(filter $$(libgcc_objdir)%,$(1))) \ - $(patsubst %,$$(gcc_objdir)/%, \ + $(patsubst $(srcdir)%,$$(gcc_srcdir)%,$(filter $(srcdir)%,$(1))) \ + $(patsubst %,$$(gcc_objdir)/%, \ $(filter-out $(srcdir)% $$(libgcc_objdir)%,$(1))) # The distinction between these two variables is no longer relevant,