aboutsummaryrefslogtreecommitdiff
path: root/libgo/sysinfo.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-06-14 11:33:42 -0700
committerIan Lance Taylor <iant@golang.org>2022-06-17 14:27:06 -0700
commit7f195a2270910a6ed08bd76e3a16b0a6503f9faf (patch)
tree053387a6fe016bd4420765eb3c45415787fae6f7 /libgo/sysinfo.c
parenta284fadcce8ef443cc3cc047a8017745efb51758 (diff)
downloadgcc-7f195a2270910a6ed08bd76e3a16b0a6503f9faf.zip
gcc-7f195a2270910a6ed08bd76e3a16b0a6503f9faf.tar.gz
gcc-7f195a2270910a6ed08bd76e3a16b0a6503f9faf.tar.bz2
libgo: permit loff_t and off_t to be macros
They are macros in musl libc, rather than typedefs, and -fgo-dump-spec doesn't handle that case. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412075
Diffstat (limited to 'libgo/sysinfo.c')
-rw-r--r--libgo/sysinfo.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
index 8ce061e..a4259c0 100644
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -357,6 +357,18 @@ enum {
};
#endif
+#if defined(HAVE_LOFF_T)
+// loff_t can be defined as a macro; for -fgo-dump-spec make sure we
+// see a typedef.
+typedef loff_t libgo_loff_t_type;
+#endif
+
+#if defined(HAVE_OFF64_T)
+typedef off64_t libgo_off_t_type;
+#else
+typedef off_t libgo_off_t_type;
+#endif
+
// The following section introduces explicit references to types and
// constants of interest to support bootstrapping libgo using a
// compiler that doesn't support -fdump-go-spec (e.g., clang), via
@@ -537,7 +549,8 @@ SREF(timex);
// From sys/types.h
TREF(pid_t);
TREF(off_t);
-TREF(loff_t);
+TREF(libgo_loff_t_type);
+TREF(libgo_off_t_type);
TREF(size_t);
TREF(ssize_t);
TREF(mode_t);