diff mbox series

rs6000: Fix up build of non-glibc/aix/darwin powerpc* targets [PR104298]

Message ID 20220131184332.GL2646553@tucnak
State New
Headers show
Series rs6000: Fix up build of non-glibc/aix/darwin powerpc* targets [PR104298] | expand

Commit Message

Jakub Jelinek Jan. 31, 2022, 6:43 p.m. UTC
Hi!

As reported by Martin, while David has added OPTION_GLIBC define to aix
and Iain to darwin, all the other non-linux targets now fail because
rs6000.md macro isn't defined.

One possibility is to define this macro in option-defaults.h which on rs6000
targets is included last, then we don't need to define it in aix/darwin
headers and for targets using linux.h or linux64.h it will DTRT too.

Bootstrapped/regtested on powerpc64le-linux, ok for trunk?

The other option is the first 2 hunks + changing the 3
  if (!OPTION_GLIBC)
    FAIL;
cases in rs6000.md to e.g.
#ifdef OPTION_GLIBC
  if (!OPTION_GLIBC)
#endif
    FAIL;
or to:
#ifdef OPTION_GLIBC
  if (!OPTION_GLIBC)
#else
  if (true)
#endif
    FAIL;
(the latter case if Richi wants to push the -Wunreachable-code changes for
GCC 13).

2022-01-31  Jakub Jelinek  <jakub@redhat.com>

	PR target/104298
	* config/rs6000/aix.h (OPTION_GLIBC): Remove.
	* config/rs6000/darwin.h (OPTION_GLIBC): Likewise.
	* config/rs6000/option-defaults.h (OPTION_GLIBC): Define to 0
	if not already defined.


	Jakub

Comments

Segher Boessenkool Jan. 31, 2022, 6:49 p.m. UTC | #1
Hi!

On Mon, Jan 31, 2022 at 07:43:32PM +0100, Jakub Jelinek wrote:
> As reported by Martin, while David has added OPTION_GLIBC define to aix
> and Iain to darwin, all the other non-linux targets now fail because
> rs6000.md macro isn't defined.
> 
> One possibility is to define this macro in option-defaults.h which on rs6000
> targets is included last, then we don't need to define it in aix/darwin
> headers and for targets using linux.h or linux64.h it will DTRT too.

That is okay for fallback definitions (like here), but not for "regular"
defaults, it is much nicer to have those explicit everywhere.

> +#ifndef OPTION_GLIBC
> +#define OPTION_GLIBC 0
> +#endif

So can you add a comment like that before this please?

Okay for trunk with that.  Thanks!


Segher
diff mbox series

Patch

--- gcc/config/rs6000/aix.h.jj	2022-01-26 11:57:58.964388591 +0100
+++ gcc/config/rs6000/aix.h	2022-01-31 10:56:07.679463171 +0100
@@ -23,7 +23,6 @@ 
 #define DEFAULT_ABI ABI_AIX
 #undef  TARGET_AIX
 #define TARGET_AIX 1
-#define OPTION_GLIBC 0
 
 /* Linux64.h wants to redefine TARGET_AIX based on -m64, but it can't be used
    in the #if conditional in options-default.h, so provide another macro.  */
--- gcc/config/rs6000/darwin.h.jj	2022-01-29 11:11:39.213629460 +0100
+++ gcc/config/rs6000/darwin.h	2022-01-31 10:56:36.466058077 +0100
@@ -34,8 +34,6 @@ 
 #endif
 #endif
 
-#define OPTION_GLIBC 0
-
 /* The object file format is Mach-O.  */
 
 #define TARGET_OBJECT_FORMAT OBJECT_MACHO
--- gcc/config/rs6000/option-defaults.h.jj	2022-01-11 23:11:21.940296477 +0100
+++ gcc/config/rs6000/option-defaults.h	2022-01-31 10:56:58.615746384 +0100
@@ -62,3 +62,7 @@ 
   {"cpu_32", "%{" OPT_ARCH32 ":%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
   {"cpu_64", "%{" OPT_ARCH64 ":%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
   {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }
+
+#ifndef OPTION_GLIBC
+#define OPTION_GLIBC 0
+#endif