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 2/2] Add gcc-ar, gcc-ranlib, gcc-ld wrappers


On Fri, Oct 29, 2010 at 01:31:31PM +0000, Joseph S. Myers wrote:
> On Fri, 29 Oct 2010, Andi Kleen wrote:
> 
> > 	* gcc-ar.in, gcc-ld.in, gcc-ranlib.in: Add.
> 
> Installed scripts are a bad idea because GCC is portable to hosts that 
> cannot run shell scripts (the *build system* can run shell scripts, but 
> the *host* may be e.g. MinGW and not able to run them).  The portable way 
> to wrap subprocesses is to use C programs using the pexecute interface, as 
> in collect2 or lto-wrapper.

The scripts are really not intended to run everywhere, just on hosts
that support LTO (or really slim lto). That eliminates most of the
oddballs.

I think the only issue is Windows, but I think it's a reasonable
requirement to have a shell installed for slim LTO. Or actually
slim lto with makefiles that need ar/ranlib or call ld directly.

> > +ARGS=""
> 
> By building up a string like this you'll have lots of problems when 
> arguments contain spaces.  

I declare that just not supported right now.

> A C wrapper naturally avoids that.

Well if you want one feel free to write one. At least the scripts
do the job for me and they work for a gcc build and some other
projects.

> 
> > +prefix=@prefix@
> > +exec_prefix=@exec_prefix@
> 
> No.  GCC installations are meant to be relocatable; if the wrapper is 
> executed from somewhere other than the $bindir in which it is installed, 
> it must find other programs relative to the directory to which it has been 
> moved, rather than reusing configure-time absolute paths.  In a C wrapper 
> you can use make_relative_prefix.

Ok I can fix that in the script I think.

The good thing is that this allows dropping the ugly rules
for interacting with autoconf.

> 
> > +while test "x$1" != "x" ; do
> > +	case "$1" in
> > +	-r) 	R=1
> > +		N="$1" 
> > +		;;
> > +	-[olvO]|-f*|-nostdlib) 
> > +		N="$1" 
> > +		;;
> 
> -o and -l take arguments, which you don't seem to be allowing for here.

I'll move that thanks.

> 
> > +if test "x$R" != "x" ; then
> > +	# work around gold bug, -r and -fuse-linker-plugin
> > +	# do not interact well. It's not needed anyways.
> > +	# the gold bug has been fixed, but still keep this.
> > +	ARGS=`echo $ARGS | sed -e s/-fuse-linker-plugin//`
> 
> Apart from the issues with spaces, echo will process some options on some 
> systems and this sed command will happily modify option arguments that 
> happen to contain that particular string.  As before, (POSIX) shell is not 
> a good language in which to do this robustly (if you e.g. assume various 
> bash features, it becomes easier).

Are these systems with funny echo supported by LTO?

In principle this could be dropped, but then everyone would need
to update their gold too.

-Andi


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