Darwin: Revise handling of some driver opts.

Darwin has a user convenience feature where some linker options are exposed
at the driver level (so one can type '-all_load' instead of '-Wl,-all_load'
or '-Xlinker -all_load').  We retain this feature, but now these options are
all marked as 'Driver' and we process them as early as possible so that they
get allocated to the right toolchain command.  There are a couple of special
cases where these driver opts are used multiple times, or to control
operations on more than one command (e.g. dynamiclib).  These are handled
specially and we then add %<xxxx specs for the commands that _do not_ need
them.  NOTE: the ordering of 'shared' and 'dynamiclib' is significant, hence
they are placed out of alphabetical order at the start.  Likewise, we keep
a couple of cases where a negative option originally appeared after the
positive alternate, potentially overriding it.

When we report an error with %e, it seems necessary to strip the option
before doing so, otherwise it survives to the cc1 command line (%e does not
appear to abort the program before this).

Right now there is no mechanism to split up the 'variable portion' (%*) of
the matched spec string, so where we have some driver specs that take 2 or
3 arguments, these cannot be processed here, but are deferred until the
LINK_SPEC, where they are copied verbatim.

We have a 'safe' version of the macOS version string, that has been sanity-
checked and truncated to minor version.  If the 'tiny' (3rd) portion of the
value is not significant, it is better to use the safe one in version-compare().

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin-driver.c (darwin_driver_init): Revise comments, handle
	filelist and framework options in specs instead of code.
	* config/darwin.h (SUBTARGET_DRIVER_SELF_SPECS): Update to handle link
	specs that are really driver ones.
	(DARWIN_CC1_SPEC): Likewise.
	(CPP_SPEC): Likewise.
	(SYSROOT_SPEC): Append space.
	(LINK_SYSROOT_SPEC): Remove most driver link specs.
	(STANDARD_STARTFILE_PREFIX_2): Update link-related specs.
	(STARTFILE_SPEC): Likewise.
	(ASM_MMACOSX_VERSION_MIN_SPEC): Fix line wrap.
	(ASM_SPEC): Update driver-related specs.
	(ASM_FINAL_SPEC): Likewise.
	* config/darwin.opt: Remove now unused option aliases.
	* config/i386/darwin.h (EXTRA_ASM_OPTS): Ensure space after opt.
	(ASM_SPEC): Update driver-related specs.
4 files changed