public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5634] LoongArch: Fix libgcc build failure when libc is not available
@ 2023-11-21 3:05 Xi Ruoyao
0 siblings, 0 replies; only message in thread
From: Xi Ruoyao @ 2023-11-21 3:05 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7bf1de918608e2d0b5a3ad0923040acb1819d9a5
commit r14-5634-g7bf1de918608e2d0b5a3ad0923040acb1819d9a5
Author: Xi Ruoyao <xry111@xry111.site>
Date: Tue Nov 21 09:09:25 2023 +0800
LoongArch: Fix libgcc build failure when libc is not available
To use int64_t we included <stdint.h> in loongarch-def.h.
Unfortunately, loongarch-def.h is also used by libgcc etc., causing a
build failure when building a "stage1" cross compiler at which the
target libc is not built yet.
As int64_t is used for a C-compatible replacement of HOST_WIDE_INT, it's
not directly or indirectly referred by the target libraries. So
guard everything requiring stdint.h with #if then they'll not block
target libraries.
gcc/ChangeLog:
* config/loongarch/loongarch-def.h (stdint.h): Guard with #if to
exclude it for target libraries.
(loongarch_isa_base_features): Likewise.
(loongarch_isa): Likewise.
(loongarch_abi): Likewise.
(loongarch_target): Likewise.
(loongarch_cpu_default_isa): Likewise.
Diff:
---
gcc/config/loongarch/loongarch-def.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/config/loongarch/loongarch-def.h b/gcc/config/loongarch/loongarch-def.h
index af7bd635d6e..851ff864eb2 100644
--- a/gcc/config/loongarch/loongarch-def.h
+++ b/gcc/config/loongarch/loongarch-def.h
@@ -46,7 +46,10 @@ along with GCC; see the file COPYING3. If not see
#ifndef LOONGARCH_DEF_H
#define LOONGARCH_DEF_H
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
#include <stdint.h>
+#endif
+
#include "loongarch-tune.h"
#ifdef __cplusplus
@@ -62,9 +65,11 @@ extern const char* loongarch_isa_base_strings[];
#define ISA_BASE_LA64V110 1
#define N_ISA_BASE_TYPES 2
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
/* Unlike other arrays, this is defined in loongarch-cpu.cc. The problem is
we cannot use the C++ header options.h in loongarch-def.c. */
extern int64_t loongarch_isa_base_features[];
+#endif
/* enum isa_ext_* */
extern const char* loongarch_isa_ext_strings[];
@@ -121,6 +126,7 @@ extern const char* loongarch_cmodel_strings[];
#define M_OPT_ABSENT(opt_enum) ((opt_enum) == M_OPT_UNSET)
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
/* Internal representation of the target. */
struct loongarch_isa
{
@@ -150,6 +156,9 @@ struct loongarch_target
int cmodel; /* CMODEL_ */
};
+extern struct loongarch_isa loongarch_cpu_default_isa[];
+#endif
+
/* CPU properties. */
/* index */
#define CPU_NATIVE 0
@@ -162,7 +171,6 @@ struct loongarch_target
/* parallel tables. */
extern const char* loongarch_cpu_strings[];
-extern struct loongarch_isa loongarch_cpu_default_isa[];
extern int loongarch_cpu_issue_rate[];
extern int loongarch_cpu_multipass_dfa_lookahead[];
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-21 3:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 3:05 [gcc r14-5634] LoongArch: Fix libgcc build failure when libc is not available Xi Ruoyao
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).