use gcc -### in ld tests

Ben Elliston bje@wasabisystems.com
Sun May 11 00:37:00 GMT 2003


Hi Alan

Everything looks okay in this patch, except for one thing:

> +	} else {
> +	    # gcc -### is like gcc -v, but doesn't execute the commands
> +	    # and wraps individual options in quotes.  Skip over config
> +	    # and version info until we get to the ld/collect2 command.
> +	    set qq [string first "\n \"" $args]
> +	    if { $qq != -1 } then {
> +		incr qq 3
> +		# Skip the command.
> +		set qq [string first "\"" $args $qq]
> +		incr qq 2
> +		# Use the rest of the line as our ld args.
> +		set ee [string first "\n" $args $qq]
> +		set args [string range $args $qq $ee]
> +		# Find where -o went, and put $ldflags there.
> +		set qq [string first " \"-o\"" $args]
> +		set a1 [string range $args 0 $qq]
> +		set a2 [string range $args $qq end]
> +		set args "$a1$ldflags$a2"

This little bit of code gets a bit hairy.  Can you choose better
variable names for qq, ee, a1 and a2?  Otherwise, okay.

Cheers, Ben



More information about the Binutils mailing list