]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
hardened: use LD_PIE_SPEC only if defined
authorAlexandre Oliva <oliva@adacore.com>
Wed, 20 Dec 2023 00:06:17 +0000 (21:06 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Wed, 20 Dec 2023 00:06:17 +0000 (21:06 -0300)
sol2.h may define LINK_PIE_SPEC and leave LD_PIE_SPEC undefined, but
gcc.cc will only provide a LD_PIE_SPEC definition if LINK_PIE_SPEC is
not defined, and thenit uses LD_PIE_SPEC guarded by #ifdef HAVE_LD_PIE
only.  Add LD_PIE_SPEC to the guard.

gcc/ChangeLog

* gcc.cc (process_command): Use LD_PIE_SPEC only if defined.

gcc/gcc.cc

index 701f5cdfb59c8f60c9c9bee310ef9de03d1ece27..d5e02c11cb05df3cc94436d8d230ffa0bf8a311f 100644 (file)
@@ -5008,7 +5008,7 @@ process_command (unsigned int decoded_options_count,
     {
       if (!any_link_options_p && !static_p)
        {
-#ifdef HAVE_LD_PIE
+#if defined HAVE_LD_PIE && defined LD_PIE_SPEC
          save_switch (LD_PIE_SPEC, 0, NULL, /*validated=*/true, /*known=*/false);
 #endif
          /* These are passed straight down to collect2 so we have to break