public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6035] Darwin, Driver: Avoid a link line for empty commands.
Date: Fri, 17 Dec 2021 09:47:38 +0000 (GMT)	[thread overview]
Message-ID: <20211217094738.769663858D35@sourceware.org> (raw)

https://gcc.gnu.org/g:ff56eea24e48f7a8a3b39db7049d1da532d4b8af

commit r12-6035-gff56eea24e48f7a8a3b39db7049d1da532d4b8af
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Wed Dec 15 20:25:27 2021 +0000

    Darwin, Driver: Avoid a link line for empty commands.
    
    We were pushing a spec value for weak_reference_mismatches unconditionally
    which is not needed (the value was the default) and the side-effect of
    this was that we appeared to need to drive a link command; leading to
    unexpected diagnostics for cases where gcc was invoked with an empty
    command line.
    
    Also we were pushing flags for sysroot, os minimum version and controls
    even if the command line was empty.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
    gcc/ChangeLog:
    
            * config/darwin-driver.c (darwin_driver_init): Exit from the
            option handling early if the command line is definitely enpty.
            * config/darwin.h (SUBTARGET_DRIVER_SELF_SPECS): Remove
            setting for the default content of weak_reference_mismatches.

Diff:
---
 gcc/config/darwin-driver.c | 8 ++++++--
 gcc/config/darwin.h        | 5 -----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 7fa80abc314..688fe8fabc0 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -416,6 +416,10 @@ darwin_driver_init (unsigned int *decoded_options_count,
     }
 #endif
 
+  /* If there is nothing else on the command line, do not add sysroot etc.  */
+  if (*decoded_options_count <= 1)
+    return;
+
   if (appendM32 || appendM64)
     {
       ++*decoded_options_count;
@@ -426,7 +430,7 @@ darwin_driver_init (unsigned int *decoded_options_count,
 		       &(*decoded_options)[*decoded_options_count - 1]);
     }
 
-  if (! seen_sysroot_p)
+  if (!seen_sysroot_p)
     {
       /* We will pick up an SDKROOT if we didn't specify a sysroot and treat
 	 it as overriding any configure-time --with-sysroot.  */
@@ -445,7 +449,7 @@ darwin_driver_init (unsigned int *decoded_options_count,
   /* We will need to know the OS X version we're trying to build for here
      so that we can figure out the mechanism and source for the sysroot to
      be used.  */
-  if (! seen_version_min && *decoded_options_count > 1)
+  if (!seen_version_min)
     /* Not set by the User, try to figure it out.  */
     vers_string = darwin_default_min_version ();
 
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 0ce13207ad6..75b688ebf9e 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -268,11 +268,6 @@ extern GTY(()) int darwin_ms_struct;
   "%{unexported_symbols_list*:\
      -Xlinker -unexported_symbols_list -Xlinker %*} \
      %<unexported_symbols_list*",					\
-  "%{!weak_reference_mismatches*:\
-     %:version-compare(< 10.5 asm_macosx_version_min= -Xlinker) \
- %:version-compare(< 10.5 asm_macosx_version_min= -weak_reference_mismatches) \
-     %:version-compare(< 10.5 asm_macosx_version_min= -Xlinker) \
-     %:version-compare(< 10.5 asm_macosx_version_min= non-weak)}",	\
   "%{weak_reference_mismatches*:\
     -Xlinker -weak_reference_mismatches -Xlinker %*} \
     %<weak_reference_mismatches*",					\


                 reply	other threads:[~2021-12-17  9:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211217094738.769663858D35@sourceware.org \
    --to=iains@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).