Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
alpine
aports
Commits
05ae03a3
Commit
05ae03a3
authored
Nov 25, 2021
by
Sören Tempel
Browse files
main/gcc: re-enable support for gcc-go
Disabled in
c29fc976
.
parent
c18d4642
Pipeline
#100798
passed with stages
in 134 minutes and 30 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
main/gcc/0042-stddef.h-add-support-for-musl-typedef-macro-guards.patch
0 → 100644
View file @
05ae03a3
From b9e9895826774d17d4bb81b165753816db562590 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Thu, 25 Nov 2021 17:44:04 +0100
Subject: [PATCH] stddef.h: add support for musl typedef macro guards
The stddef.h header checks/sets various hardcoded toolchain/os specific
macro guards to prevent redefining types such as ptrdiff_t, wchar_t, or
size_t. However, without this patch, the file does not check/set the
typedef macro guards for musl libc. This causes types such as size_t to
be defined twice for files which include both musl's stddef.h as well as
GCC's ginclude/stddef.h. This is, for example, the case for
libgo/sysinfo.c. If libgo/sysinfo.c has multiple typedefs for size_t
this confuses -fdump-go-spec and causes size_t not to be included in the
generated type definitions thereby causing a gcc-go compilation failure
on musl with the following error message:
sysinfo.go:7765:13: error: use of undefined type '_size_t'
7765 | type Size_t _size_t
| ^
libcall_posix.go:49:35: error: non-integer len argument in make
49 | b := make([]byte, len)
|
This commit fixes this issue by ensuring that ptrdiff_t, wchar_t, and size_t
are only defined once in the pre-processed libgo/sysinfo.c file by enhancing
gcc/ginclude/stddef.h with musl-specific typedef macro guards.
---
gcc/ginclude/stddef.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 66619fe43b1..50d710a5ab9 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -128,6 +128,7 @@
_TYPE_wchar_t;
#ifndef ___int_ptrdiff_t_h
#ifndef _GCC_PTRDIFF_T
#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
+#ifndef __DEFINED_ptrdiff_t /* musl libc */
#define _PTRDIFF_T
#define _T_PTRDIFF_
#define _T_PTRDIFF
@@ -137,10 +138,12 @@
_TYPE_wchar_t;
#define ___int_ptrdiff_t_h
#define _GCC_PTRDIFF_T
#define _PTRDIFF_T_DECLARED
+#define __DEFINED_ptrdiff_t
#ifndef __PTRDIFF_TYPE__
#define __PTRDIFF_TYPE__ long int
#endif
typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#endif /* __DEFINED_ptrdiff_t */
#endif /* _PTRDIFF_T_DECLARED */
#endif /* _GCC_PTRDIFF_T */
#endif /* ___int_ptrdiff_t_h */
@@ -174,6 +177,7 @@
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifndef _SIZE_T_DEFINED
#ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */
#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */
+#ifndef __DEFINED_size_t /* musl libc */
#ifndef ___int_size_t_h
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
@@ -191,6 +195,7 @@
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#define _SIZE_T_DEFINED
#define _BSD_SIZE_T_DEFINED_ /* Darwin */
#define _SIZE_T_DECLARED /* FreeBSD 5 */
+#define __DEFINED_size_t /* musl libc */
#define ___int_size_t_h
#define _GCC_SIZE_T
#define _SIZET_
@@ -215,6 +220,7 @@
typedef long ssize_t;
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
#endif /* ___int_size_t_h */
+#endif /* __DEFINED_size_t */
#endif /* _SIZE_T_DECLARED */
#endif /* _BSD_SIZE_T_DEFINED_ */
#endif /* _SIZE_T_DEFINED */
@@ -251,6 +257,7 @@
typedef long ssize_t;
#ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */
#ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */
#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
+#ifndef __DEFINED_wchar_t /* musl libc */
#ifndef _WCHAR_T_DEFINED_
#ifndef _WCHAR_T_DEFINED
#ifndef _WCHAR_T_H
@@ -272,6 +279,7 @@
typedef long ssize_t;
#define __INT_WCHAR_T_H
#define _GCC_WCHAR_T
#define _WCHAR_T_DECLARED
+#define __DEFINED_wchar_t
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
@@ -326,6 +334,7 @@
typedef __WCHAR_TYPE__ wchar_t;
#endif
#endif
#endif
+#endif /* __DEFINED_wchar_t */
#endif /* _WCHAR_T_DECLARED */
#endif /* _BSD_RUNE_T_DEFINED_ */
#endif
main/gcc/APKBUILD
View file @
05ae03a3
...
...
@@ -8,7 +8,7 @@ pkgver=11.2.1_git20211125
[
"
$CHOST
"
!=
"
$CTARGET
"
]
&&
_target
=
"-
$CTARGET_ARCH
"
||
_target
=
""
pkgname
=
"
$pkgname$_target
"
pkgrel
=
0
pkgrel
=
1
pkgdesc
=
"The GNU Compiler Collection"
url
=
"https://gcc.gnu.org"
arch
=
"all"
...
...
@@ -24,8 +24,7 @@ replaces="libstdc++ binutils"
:
"
${
LANG_CXX
:
=true
}
"
:
"
${
LANG_D
:
=true
}
"
:
"
${
LANG_OBJC
:
=true
}
"
# Go frontend presently fails to build due to missing _size_t type in sysinfo.go.
:
"
${
LANG_GO
:
=false
}
"
:
"
${
LANG_GO
:
=true
}
"
:
"
${
LANG_FORTRAN
:
=true
}
"
:
"
${
LANG_ADA
:
=true
}
"
...
...
@@ -214,6 +213,7 @@ source="https://dev.alpinelinux.org/~nenolod/gcc-${pkgver}.tar.xz
0039-Use-generic-errstr.go-implementation-on-musl.patch
0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0041-configure-fix-detection-of-atomic-builtins-in-libato.patch
0042-stddef.h-add-support-for-musl-typedef-macro-guards.patch
"
# we build out-of-tree
...
...
@@ -704,4 +704,5 @@ f7eefa7ae1f31fc7bc1721578d4c1642f2ef5feda37dec03264dde53717474437722ee646ab9a837
83deca7a68c6e1ce934f79b5d1e1a4b8b8a25c7bc24c3ef934307c232e168d9b17048a00a040fe81ac0cf6d4a23beefb292369c35d9896dab440dda228c90b0a 0039-Use-generic-errstr.go-implementation-on-musl.patch
4074c62c2ee0ed555f01bf0cc69e32ef275bc3ac74de1d428ba1a2ac59fae973fe6f9aab8b3796df4bda7ab7cf220e5e1cbfdf103f41e4cbea175067a947d08f 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
1fe1b1e9ec288f65cd0d80a74b0a060b29c40e501f666b01e2825b61949be4568aeaf7cf473142889a7fd5e011b096837a651582d64fce67500fcb2ba39e16ce 0041-configure-fix-detection-of-atomic-builtins-in-libato.patch
0a66c5a567e15dafac0bcad5c9dd5e98c44c74cbe539340ad28cbf6d26b994bab46b355f3a3a57b830f802145cfd826ad8d87359ebc5d6a20ef41e968904c7dc 0042-stddef.h-add-support-for-musl-typedef-macro-guards.patch
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment