This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR ada/42254, avoid providing multiple copies of object files to link of GNAT tools


I've corrected the ridiculously long lines, sorry

This is a corrected re-post of an earlier patch, posted 11 Jan, titled just 
"[Ada] Avoid providing multiple copies of object files to link of GNAT tools".

gcc/ada/gcc-interface/Makefile.in provides the linker with multiple
copies of object files (those in the RTS), in two cases by explicitly
listing them (macros GNATLINK_OBJS, GNATMAKE_OBJS) and then
linking against LIBGNAT and in the others (target common-tools) by 
leaving .o files in the RTS directory for gnatbind to see and use and 
by calling up LIBGNAT twice (by including LIBGNAT in macro 
TOOLS_LIBS when it is implicitly included by gnatbind already).

This is legal if unnecessary behaviour, I think, but in Xcode 3.2
(used in darwin10, Snow Leopard) Apple have introduced a bug (radar
6320843 "duplicate symbols from static libraries not properly
ignored") which prevents building any of the GNAT tools.

Other languages have had similar though less pervasive problems, see
PR bootstrap/41180.

The only part of this patch you may be uncomfortable with is the change 
to target common-tools, where I delete all the .o files in the RTS directory 
that are already in libgna*.a before the gnatmake -b step (the problem 
being that if gnatbind sees a .o file it includes it in the files to be linked, 
being unaware that the object is already in libgna*.a). The .o files that 
survive are g-trasym.o and (on powerpc-wrs-vxworks) memtrack.o - but 
the latter doesn't get installed.

Tested on x86_64-apple-darwin10, x86_64-unknown-linux-gnu [Debian 
5, I didn't say --build= which may explain the -unknown- ?] and 
powerpc-wrs-vxworks hosted on i386-apple-darwin10.

2010-01-26  Simon Wright  <simon@pushface.org>

	PR ada/42554
	* gcc-interface/Makefile.in (TOOLS_LIBS): remove LIB_GNAT.
	* gcc-interface/Makefile.in (GNATLINK_OBJS): remove object files
	that are present in the RTS.
	* gcc-interface/Makefile.in (GNATMAKE_OBJS): likewise.
	* gcc-interface/Makefile.in (common-tools): at the start, delete
	all the .o files in the RTS directory that are also in libraries.
	* gcc-interface/Makefile.in (../../gnatmake$(exeext)): add LIBGNAT.
	* gcc-interface/Makefile.in (../../gnatlink$(exeext)):likewise.

Attachment: gcc-ada-gcc-interface-Makefile.in.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]