driver: Fix bootstrap with --enable-default-pie

Message ID ZW8CM4RO7kxacSjh@tucnak
State Unresolved
Headers
Series driver: Fix bootstrap with --enable-default-pie |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jakub Jelinek Dec. 5, 2023, 10:57 a.m. UTC
  Hi!

On IRC Iain mentioned bootstrap is broken for him presumably since
r14-5791 -fhardened addition.  I think it is only a problem with
--enable-default-pie when the case OPT_pie: wants to fall through
into case OPT_r: and warns.
Before the patch validated = true; was set up if ENABLE_DEFAULT_PIE
for OPT_pie, and for -fhardened as documented I think we want to
set any_link_options_p = true; for it too:
/* True if -r, -shared, -pie, or -no-pie were specified on the command
   line.  */
static bool any_link_options_p;

Ok for trunk if it passes bootstrap/regtest?

2023-12-05  Jakub Jelinek  <jakub@redhat.com>

	* gcc.cc (driver_handle_option): Add /* FALLTHROUGH */ comment
	between OPT_pie and OPT_r cases.


	Jakub
  

Comments

Richard Biener Dec. 5, 2023, 12:22 p.m. UTC | #1
On Tue, 5 Dec 2023, Jakub Jelinek wrote:

> Hi!
> 
> On IRC Iain mentioned bootstrap is broken for him presumably since
> r14-5791 -fhardened addition.  I think it is only a problem with
> --enable-default-pie when the case OPT_pie: wants to fall through
> into case OPT_r: and warns.
> Before the patch validated = true; was set up if ENABLE_DEFAULT_PIE
> for OPT_pie, and for -fhardened as documented I think we want to
> set any_link_options_p = true; for it too:
> /* True if -r, -shared, -pie, or -no-pie were specified on the command
>    line.  */
> static bool any_link_options_p;
> 
> Ok for trunk if it passes bootstrap/regtest?

OK.

> 2023-12-05  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* gcc.cc (driver_handle_option): Add /* FALLTHROUGH */ comment
> 	between OPT_pie and OPT_r cases.
> 
> --- gcc/gcc.cc.jj	2023-12-01 08:10:43.272316590 +0100
> +++ gcc/gcc.cc	2023-12-05 11:47:54.046202161 +0100
> @@ -4617,6 +4617,7 @@ driver_handle_option (struct gcc_options
>        /* -pie is turned on by default.  */
>        validated = true;
>  #endif
> +      /* FALLTHROUGH */
>      case OPT_r:
>      case OPT_shared:
>      case OPT_no_pie:
> 
> 	Jakub
> 
>
  

Patch

--- gcc/gcc.cc.jj	2023-12-01 08:10:43.272316590 +0100
+++ gcc/gcc.cc	2023-12-05 11:47:54.046202161 +0100
@@ -4617,6 +4617,7 @@  driver_handle_option (struct gcc_options
       /* -pie is turned on by default.  */
       validated = true;
 #endif
+      /* FALLTHROUGH */
     case OPT_r:
     case OPT_shared:
     case OPT_no_pie: