[pushed] Driver: Fix bootstrap with DEFAULT_{ASSEMBLER,LINKER,DSYMUTIL}.

Message ID E0C0C5AA-B36C-4C04-9782-436A33DA53A3@sandoe.co.uk
State Committed
Commit abdf63d782cba82b5ecf264248518cbb065650ed
Headers
Series [pushed] Driver: Fix bootstrap with DEFAULT_{ASSEMBLER,LINKER,DSYMUTIL}. |

Commit Message

Iain Sandoe Sept. 20, 2021, 6:50 a.m. UTC
  Hi

The patch at r12-3662-g5fee8a0a9223d factored the code for
printing the names of programes into a separate function.
However the moved editions that print out the names of the
assembler, linker (and dsymutil on Darwin) when those are
specified at configure-time were not adjusted accordingly,
leading to a bootstrap fail.

Fixed by testing specifically for execute OK, since we know
these are programs.

tested on i686-darwin9, x86_64-darwin20 configured with
—with-{as,ld,dsymutil}= and on x86_64-darwin18 without.

confirmed that the build and installed versions print the right
thing (and, of course, that bootstrap succeeds).

pushed to master as bootstrap fix, thanks
Iain

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

gcc/ChangeLog:

	* gcc.c: Test for execute OK when we find the
	programs for assembler linker and dsymutil and those
	were specified at configure-time.
---
 gcc/gcc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--
  

Comments

Jeff Law Sept. 20, 2021, 2:36 p.m. UTC | #1
On 9/20/2021 12:50 AM, Iain Sandoe wrote:
> Hi
>
> The patch at r12-3662-g5fee8a0a9223d factored the code for
> printing the names of programes into a separate function.
> However the moved editions that print out the names of the
> assembler, linker (and dsymutil on Darwin) when those are
> specified at configure-time were not adjusted accordingly,
> leading to a bootstrap fail.
>
> Fixed by testing specifically for execute OK, since we know
> these are programs.
>
> tested on i686-darwin9, x86_64-darwin20 configured with
> —with-{as,ld,dsymutil}= and on x86_64-darwin18 without.
>
> confirmed that the build and installed versions print the right
> thing (and, of course, that bootstrap succeeds).
>
> pushed to master as bootstrap fix, thanks
> Iain
>
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>
> gcc/ChangeLog:
>
> 	* gcc.c: Test for execute OK when we find the
> 	programs for assembler linker and dsymutil and those
> 	were specified at configure-time.
Thanks for taking care of this.  Sorry for the breakage.

jeff
  

Patch

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 1a74bf92f7a..506c2acc282 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3083,17 +3083,17 @@  find_a_program (const char *name)
   /* Do not search if default matches query. */
 
 #ifdef DEFAULT_ASSEMBLER
-  if (! strcmp (name, "as") && access (DEFAULT_ASSEMBLER, mode) == 0)
+  if (! strcmp (name, "as") && access (DEFAULT_ASSEMBLER, X_OK) == 0)
     return xstrdup (DEFAULT_ASSEMBLER);
 #endif
 
 #ifdef DEFAULT_LINKER
-  if (! strcmp (name, "ld") && access (DEFAULT_LINKER, mode) == 0)
+  if (! strcmp (name, "ld") && access (DEFAULT_LINKER, X_OK) == 0)
     return xstrdup (DEFAULT_LINKER);
 #endif
 
 #ifdef DEFAULT_DSYMUTIL
-  if (! strcmp (name, "dsymutil") && access (DEFAULT_DSYMUTIL, mode) == 0)
+  if (! strcmp (name, "dsymutil") && access (DEFAULT_DSYMUTIL, X_OK) == 0)
     return xstrdup (DEFAULT_DSYMUTIL);
 #endif