Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c99d38858 | ||
|
|
7ac2abf20b | ||
|
|
bca632d4f6 | ||
|
|
0569fdd9f8 | ||
|
|
75f91b45de | ||
|
|
fde3200e27 | ||
|
|
adf2d837af | ||
|
|
a64a9a1ca0 | ||
|
|
166acbc194 | ||
|
|
2bcb2246ce | ||
|
|
c3669975e9 | ||
|
|
152f8e4715 | ||
|
|
d27e1bd65d | ||
|
|
35659b6b0d | ||
|
|
af198149e0 | ||
|
|
fa915996b0 | ||
|
|
64b0044426 | ||
|
|
594fe30620 | ||
|
|
93a6d69fe8 | ||
|
|
8730f20fc9 | ||
|
|
98284111ed | ||
|
|
4f27e36d60 | ||
|
|
33594e6d6d | ||
|
|
c0db634e92 | ||
|
|
314d1e58c3 | ||
|
|
40a3650f23 | ||
|
|
01b684f271 | ||
|
|
bee023cc1c | ||
|
|
1466b2be98 | ||
|
|
5945753142 | ||
|
|
47e1660711 | ||
|
|
213913c122 | ||
|
|
bbf6fa2e71 | ||
|
|
7b35230958 | ||
|
|
09670b7395 | ||
|
|
eea97fa1a8 | ||
|
|
66c863af81 | ||
|
|
33254c4d19 | ||
|
|
b243969ea7 | ||
|
|
33c59fc7fa | ||
|
|
d59be3b0ea | ||
|
|
f3b5419349 | ||
|
|
1e9be758ea | ||
|
|
e756db4ba3 | ||
|
|
fb119cc8e2 | ||
|
|
ca20cbcaf4 | ||
|
|
383bdab043 | ||
|
|
e07103fb74 | ||
|
|
8141d4f90f | ||
|
|
ac7fc0276b | ||
|
|
a722471215 | ||
|
|
3695a9246a | ||
|
|
66982061a1 | ||
|
|
75cd718f5c | ||
|
|
ac073485e0 | ||
|
|
ce8f4219d2 | ||
|
|
ecc98c26de | ||
|
|
f046cd5d1b | ||
|
|
a787222aeb | ||
|
|
22e26ced4f | ||
|
|
aebf7d2898 | ||
|
|
3afcd215a7 | ||
|
|
595821f808 | ||
|
|
05030c7cfe | ||
|
|
6c06572dba | ||
|
|
9183be336b | ||
|
|
04c166cdde | ||
|
|
2f315e3b72 | ||
|
|
047a8ba6dc | ||
|
|
7273c5d1b3 | ||
|
|
a4a0451269 | ||
|
|
891109adce | ||
|
|
fd90572c61 | ||
|
|
7d673c4301 | ||
|
|
8c466207dd | ||
|
|
3ff8cfa528 | ||
|
|
7125b75b68 | ||
|
|
0a74080b08 | ||
|
|
2707def9f8 | ||
|
|
1bb85eecbd | ||
|
|
433e4155f1 | ||
|
|
9cbee8fda5 | ||
|
|
4531d7695c | ||
|
|
0dfce721cc | ||
|
|
dbff2ff79a | ||
|
|
f2bc2753ff | ||
|
|
a35a23e11a | ||
|
|
673dae7860 | ||
|
|
02d45f3a5e | ||
|
|
ec0d98e9be | ||
|
|
148967f00b | ||
|
|
1f2aab3a86 | ||
|
|
1191682ea6 | ||
|
|
2f9f93db59 | ||
|
|
c92b3e8cf8 | ||
|
|
b057815623 | ||
|
|
16b24bb86f | ||
|
|
bee146fb1f | ||
|
|
6e867c57ec | ||
|
|
7aaee51a3e | ||
|
|
a27a7ce737 | ||
|
|
b86f80890e | ||
|
|
10ff840e85 | ||
|
|
d91cf7fdf4 | ||
|
|
00bd9b7525 | ||
|
|
b97f685e4a | ||
|
|
d4ee51e6fb | ||
|
|
b402c03b1f | ||
|
|
9784f1b83f | ||
|
|
b92f2efff2 | ||
|
|
32532c7530 | ||
|
|
9e4a82a503 | ||
|
|
a58ac8384e | ||
|
|
b8780e2cb6 | ||
|
|
e3ffc66577 | ||
|
|
89a7cbc4df | ||
|
|
d68c6de7a5 | ||
|
|
fe3f50084b | ||
|
|
bb359dfc4f | ||
|
|
280605a1f9 | ||
|
|
d737c7757e | ||
|
|
61c985a901 | ||
|
|
575bbc458e | ||
|
|
cba716d2ec | ||
|
|
4c5c74bb8a | ||
|
|
1542dbfb9d | ||
|
|
c7dc9e5fc3 | ||
|
|
fcc93a83df | ||
|
|
d6cb995b99 | ||
|
|
d8be6416d2 | ||
|
|
fc5d3bdd60 | ||
|
|
594304eb29 | ||
|
|
ab590f2186 | ||
|
|
fc08a804bc | ||
|
|
7c7c18e40f | ||
|
|
6981fb47b6 | ||
|
|
aa9127f92c | ||
|
|
eb2dd0b952 | ||
|
|
b7fd6c90b0 | ||
|
|
91035012b1 | ||
|
|
c45c27008c | ||
|
|
85f9a49ad6 | ||
|
|
a0678836a1 | ||
|
|
a85c880974 | ||
|
|
4f712b5771 | ||
|
|
584337aa82 | ||
|
|
5e7faf1a09 | ||
|
|
2ccd927e23 | ||
|
|
9db5f1d9f6 | ||
|
|
2b7036dd54 | ||
|
|
ccc870dcf9 | ||
|
|
3802b2cd40 | ||
|
|
9d98a872ed | ||
|
|
89ef6fcef8 | ||
|
|
ff09c35b63 | ||
|
|
eab0457e00 | ||
|
|
ba6c4be060 | ||
|
|
156d093bc5 | ||
|
|
e95d28a6e7 | ||
|
|
8e5d58b8ad | ||
|
|
a58776b2a5 | ||
|
|
a135553ee7 | ||
|
|
50f178a8fd | ||
|
|
1cbc021701 | ||
|
|
de609bf946 | ||
|
|
c1b08d8c60 | ||
|
|
1af1eafd23 | ||
|
|
9271ab80b6 | ||
|
|
f60539ea18 | ||
|
|
a3ae92f0ff | ||
|
|
2f6a7c9f77 | ||
|
|
21facd5cd5 | ||
|
|
f8285416e1 | ||
|
|
2163de2a5f | ||
|
|
0109016e86 | ||
|
|
af5183e062 | ||
|
|
e3154dd055 | ||
|
|
5ce0b6ae4d | ||
|
|
c960b3d941 | ||
|
|
9147bbd9bc | ||
|
|
ecb08a4388 | ||
|
|
245d41d7c5 | ||
|
|
e9e3295925 | ||
|
|
63373d18a5 | ||
|
|
03ee2e9bba | ||
|
|
aacc9f48dd | ||
|
|
7553dc4011 | ||
|
|
3301dc90d8 | ||
|
|
a7467afe2f | ||
|
|
4f72f9b96c | ||
|
|
e03c6469a7 | ||
|
|
96179b88df | ||
|
|
502474cc3a | ||
|
|
bbead6a9c6 | ||
|
|
b13fe4ece0 | ||
|
|
a1242ed35e | ||
|
|
3c4080e8f5 | ||
|
|
6dbe4fdc31 | ||
|
|
196abb1575 | ||
|
|
da52dace85 | ||
|
|
8f78988b33 | ||
|
|
c88cfa516f | ||
|
|
613aa1c68a | ||
|
|
a2f75963bf | ||
|
|
23790a3577 | ||
|
|
cb79ff57d3 | ||
|
|
dadfca1fb8 | ||
|
|
c18d2da154 | ||
|
|
67b5dd49dd | ||
|
|
fa69d91465 | ||
|
|
cf6b0ff530 | ||
|
|
59c3894c44 | ||
|
|
5230a69c3a | ||
|
|
4ee3b769fb | ||
|
|
7f12e90c18 | ||
|
|
432c4991fd | ||
|
|
c7c7fbce18 | ||
|
|
955ac29f0d | ||
|
|
1c42df3769 | ||
|
|
e38db6e4de | ||
|
|
0b523f354b | ||
|
|
c906b166b2 | ||
|
|
ad249d3b87 | ||
|
|
4a43f241ee | ||
|
|
1009f265d1 | ||
|
|
64e671aea3 | ||
|
|
d4e96df17d | ||
|
|
df76034e32 | ||
|
|
8c77e7e42f | ||
|
|
3bf4fe443f | ||
|
|
7f6b7fb2d0 | ||
|
|
f7cf971e40 | ||
|
|
62f19c3e03 | ||
|
|
68c728e63c | ||
|
|
a2365ffc57 | ||
|
|
d4eed06542 | ||
|
|
64dc758fed | ||
|
|
27e98026e4 | ||
|
|
6ec2ba3c03 | ||
|
|
63b661faa4 | ||
|
|
cbb3d09687 | ||
|
|
fe0c0492a1 | ||
|
|
8611e23f3c | ||
|
|
4c3be3aa14 | ||
|
|
02198dccdd | ||
|
|
341e959e45 | ||
|
|
db00e85baf | ||
|
|
259e8cc44f | ||
|
|
f2b1d7e206 | ||
|
|
0307dc695e | ||
|
|
fac4d7e178 | ||
|
|
12d2830ba7 | ||
|
|
a98c9ab918 | ||
|
|
be2368a676 | ||
|
|
99d21ecfef | ||
|
|
c1a125b56f | ||
|
|
bdec0258b6 | ||
|
|
97b18eafb2 | ||
|
|
7ff30616ef | ||
|
|
1fcbdb1819 | ||
|
|
d86cd0c188 | ||
|
|
5e2730d2db | ||
|
|
73376dee97 | ||
|
|
5e73fe103a | ||
|
|
f8d12ed781 | ||
|
|
f01b561b97 | ||
|
|
a258f27d03 | ||
|
|
f288cdaa77 | ||
|
|
96f8084bcd | ||
|
|
04250e1e41 | ||
|
|
36cff31884 | ||
|
|
a2c2a6573e | ||
|
|
909df1c8e5 | ||
|
|
6d22ee8398 | ||
|
|
c689986438 | ||
|
|
5c78e255a6 | ||
|
|
44f1e77115 | ||
|
|
909aebe26f | ||
|
|
623702d4cf | ||
|
|
d8c4343bea | ||
|
|
9ce52b3587 | ||
|
|
c4fac0adfa | ||
|
|
5db3c291f2 | ||
|
|
9ecbd62fce | ||
|
|
d49ecb9dbb | ||
|
|
9a462d3759 | ||
|
|
76f5a4ab50 | ||
|
|
bbce946108 | ||
|
|
0948a1659c | ||
|
|
930d8ecad2 | ||
|
|
e2c984606f | ||
|
|
789343b8c7 | ||
|
|
2acece294a | ||
|
|
8c19bf2f9b | ||
|
|
d410854f6c | ||
|
|
2d51770a74 | ||
|
|
5e9e802c67 | ||
|
|
e017c774f1 | ||
|
|
8185d66b73 | ||
|
|
594a34459e | ||
|
|
9529c0ab42 | ||
|
|
2852f55ff0 | ||
|
|
aaf1306126 | ||
|
|
c102971e27 | ||
|
|
b47abadccc | ||
|
|
f4acff31f9 | ||
|
|
766020c811 | ||
|
|
9d15b45746 | ||
|
|
8b3c4eb6d3 | ||
|
|
c31c11cad9 | ||
|
|
8029ed0762 | ||
|
|
5361b42aeb | ||
|
|
4a8a890148 | ||
|
|
e78098c34f | ||
|
|
c9dc088afd | ||
|
|
2decd7eb54 | ||
|
|
c831889cb3 | ||
|
|
e5334cd8fa | ||
|
|
63e8cff254 | ||
|
|
665bcc199d | ||
|
|
445e530314 | ||
|
|
fb9bc89df8 | ||
|
|
784919ce5e | ||
|
|
e34cce6e0f | ||
|
|
adcc988069 | ||
|
|
052fdf55ac | ||
|
|
8d07a9897a | ||
|
|
45aaac6d30 | ||
|
|
a526c9213d | ||
|
|
5c42cad7a6 | ||
|
|
dc9e47ae00 | ||
|
|
eafbfdc95c | ||
|
|
2837bdb657 | ||
|
|
d6931ca312 | ||
|
|
924a2cb8d3 | ||
|
|
5985852e77 | ||
|
|
c49180f8cf | ||
|
|
13046d8972 | ||
|
|
82ad096a42 | ||
|
|
99abd2fdf0 | ||
|
|
62bd0f84bd | ||
|
|
4fe645dead | ||
|
|
89a5382518 | ||
|
|
94b2f1a6f0 | ||
|
|
6a161e0a2d | ||
|
|
d0d05b39cd | ||
|
|
ff797d6bfe | ||
|
|
2f8a5bf400 | ||
|
|
20713e27a3 | ||
|
|
e7a8141113 | ||
|
|
7270f472e3 | ||
|
|
8ff73a7de4 | ||
|
|
97ed826c3c | ||
|
|
32646621be | ||
|
|
2b3254df32 | ||
|
|
f007868914 | ||
|
|
a8dbcc046f | ||
|
|
d4762ed74f | ||
|
|
8f37872995 | ||
|
|
cb8105ee14 | ||
|
|
f27500700e | ||
|
|
10df987e0e | ||
|
|
4144c7631f | ||
|
|
1efe44bb36 | ||
|
|
afc11656d8 | ||
|
|
2c5274eeed | ||
|
|
57d953746e | ||
|
|
192ca97cd5 | ||
|
|
4818c2c2cd | ||
|
|
2c68614713 | ||
|
|
b15f448999 | ||
|
|
4668038a9a |
No files matched your search
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh -e
|
||||
# Description: run apkbuild-lint on modified APKBUILDs
|
||||
# Options: native
|
||||
# Use 'native' because it requires git commit history.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Wrap pmbootstrap to use this repository for --aports
|
||||
pmaports="$(cd $(dirname $0)/..; pwd -P)"
|
||||
_pmbootstrap="$(command -v pmbootstrap)"
|
||||
pmbootstrap() {
|
||||
"$_pmbootstrap" --aports="$pmaports" "$@"
|
||||
}
|
||||
|
||||
.ci/lib/apkbuild_linting.py
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib/build_changed_aports.sh
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib/build_changed_aports.sh
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib/build_changed_aports.sh
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib/build_changed_aports.sh
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib/build_changed_aports.sh
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib/build_changed_aports.sh
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Convenience wrapper for short arch-specific build jobs in .gitlab-ci.yml
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
JOB_ARCH="${CI_JOB_NAME#build-}"
|
||||
|
||||
set -x
|
||||
su pmos -c ".ci/build_changed_aports.py $JOB_ARCH"
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if grep -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb'; then
|
||||
echo 'Please do not install dtbs to /usr/share/dtb!'
|
||||
echo 'Unless you have a good reason not to, please put them in /boot/dtbs'
|
||||
exit 1
|
||||
fi
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: check pkgver/pkgrel bumps, amount of changed pkgs etc
|
||||
# Options: native
|
||||
# Use 'native' because it requires git commit history.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
# In .gitlab-ci.yml currently .ci/pytest.sh runs before this and
|
||||
# already downloads and runs install_pmbootstrap.sh.
|
||||
if ! [ -e install_pmbootstrap.sh ]; then
|
||||
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
fi
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
.ci/lib/check_changed_aports_versions.py
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh -e
|
||||
# Description: editorconfig-checker: lint for trailing whitespaces etc.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add \
|
||||
editorconfig-checker
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
set -x
|
||||
ec
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh -e
|
||||
# Description: lint CI related python scripts/tests
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add py3-flake8
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
flake8 --ignore E501,F401,E722,W504,W605 $(find .ci -name '*.py')
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh -e
|
||||
# Description: check various bad patterns with grep
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add grep
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Find CHANGEMEs in APKBUILDs
|
||||
if grep -qr '(CHANGEME!)' *; then
|
||||
echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
|
||||
grep --color=always -r '(CHANGEME!)' *
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# DTBs installed to /usr/share/db
|
||||
# FIXME: doesn't pass currently, fix it and enable it afterwards
|
||||
# if grep -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb'; then
|
||||
# echo 'Please do not install dtbs to /usr/share/dtb!'
|
||||
# echo 'Unless you have a good reason not to, please put them in /boot/dtbs'
|
||||
# exit 1
|
||||
# fi
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh -e
|
||||
# Description: check all kernel configs with 'pmbootstrap kconfig check'
|
||||
# Options: native
|
||||
# Use 'native' because it requires running pmbootstrap.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Wrap pmbootstrap to use this repository for --aports
|
||||
pmaports="$(cd $(dirname $0)/..; pwd -P)"
|
||||
_pmbootstrap="$(command -v pmbootstrap)"
|
||||
pmbootstrap() {
|
||||
"$_pmbootstrap" --aports="$pmaports" "$@"
|
||||
}
|
||||
|
||||
set -x
|
||||
pmbootstrap kconfig check
|
||||
+1
@@ -0,0 +1 @@
|
||||
../testcases/add_pmbootstrap_to_import_path
|
||||
File renamed without changes.
@@ -7,7 +7,7 @@ import sys
|
||||
import common
|
||||
|
||||
# pmbootstrap
|
||||
import testcases.add_pmbootstrap_to_import_path
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
import pmb.parse._apkbuild
|
||||
import pmb.helpers.pmaports
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh -e
|
||||
# Description: build modified packages for this architecture
|
||||
# Options: native slow
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
# Get the architecture from the symlink we are running
|
||||
arch="$(echo "$0" | cut -d '-' -f 2 | cut -d '.' -f 1)"
|
||||
|
||||
set -x
|
||||
.ci/lib/build_changed_aports.py "$arch"
|
||||
@@ -11,7 +11,7 @@ import subprocess
|
||||
import common
|
||||
|
||||
# pmbootstrap
|
||||
import testcases.add_pmbootstrap_to_import_path # noqa
|
||||
import add_pmbootstrap_to_import_path # noqa
|
||||
import pmb.parse
|
||||
import pmb.parse.version
|
||||
import pmb.helpers.logging
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import argparse
|
||||
@@ -13,7 +13,7 @@ def get_devices():
|
||||
""":returns: list of all devices"""
|
||||
ret = []
|
||||
pmaports = (os.path.realpath(os.path.join(os.path.dirname(__file__) +
|
||||
"/..")))
|
||||
"/../..")))
|
||||
for path in glob.glob(pmaports + "/device/*/device-*/"):
|
||||
device = os.path.dirname(path).split("device-", 1)[1]
|
||||
|
||||
@@ -110,7 +110,7 @@ def main():
|
||||
print("")
|
||||
print("Now it's time to add some documentation:")
|
||||
print("1) Create a device specific wiki page as described here:")
|
||||
print(" <https://wiki.postmarketos.org/wiki/Help:Device_Page>")
|
||||
print(" https://wiki.postmarketos.org/wiki/Help:Device_Page")
|
||||
print("2) Set 'booting = yes' in the infobox of your device page.")
|
||||
print("3) Run these tests again with an empty commit in your MR:")
|
||||
print(" $ git commit --allow-empty -m 'run tests again'")
|
||||
@@ -17,7 +17,7 @@ def get_pmaports_dir():
|
||||
global cache
|
||||
if "pmaports_dir" in cache:
|
||||
return cache["pmaports_dir"]
|
||||
ret = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
||||
ret = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/../.."))
|
||||
cache["pmaports_dir"] = ret
|
||||
return ret
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
if ! mount | grep -q /proc/sys/fs/binfmt_misc; then
|
||||
echo "Mounting binfmt_misc"
|
||||
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
|
||||
fi
|
||||
|
||||
if id "build" > /dev/null 2>&1; then
|
||||
echo "User 'build' exists already"
|
||||
else
|
||||
echo "Creating build user"
|
||||
adduser -D build
|
||||
chown -R build:build .
|
||||
echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
fi
|
||||
File renamed without changes.
@@ -1,10 +1,21 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2021 Oliver Smith
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: lint with various python tests
|
||||
# Options: native
|
||||
# Use 'native' because it requires pmbootstrap.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
# Require pmbootstrap
|
||||
if ! command -v pmbootstrap > /dev/null; then
|
||||
echo "ERROR: pmbootstrap needs to be installed."
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh pytest
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Require pytest to be installed on the host system
|
||||
if [ -z "$(command -v pytest)" ]; then
|
||||
echo "ERROR: pytest command not found, make sure it is in your PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+11
-12
@@ -1,16 +1,15 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2021 Oliver Smith
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Description: lint all shell scripts
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
set -e
|
||||
DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||
cd "$DIR/.."
|
||||
DIR="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||
|
||||
# Find CHANGEMEs in APKBUILDs
|
||||
if grep -qr '(CHANGEME!)' *; then
|
||||
echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
|
||||
grep --color=always -r '(CHANGEME!)' *
|
||||
exit 1
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add shellcheck
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
# Shell: shellcheck
|
||||
@@ -24,11 +23,10 @@ sh_files="
|
||||
./main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.sh
|
||||
./main/postmarketos-mkinitfs-hook-netboot/netboot.sh
|
||||
./main/postmarketos-update-kernel/update-kernel.sh
|
||||
./main/swclock-offset/swclock-offset-boot.sh
|
||||
./main/swclock-offset/swclock-offset-shutdown.sh
|
||||
./main/ttyescape/*.post-install
|
||||
./main/unl0kr/unlock.sh
|
||||
./main/msm-firmware-loader/*.post-install
|
||||
./device/community/soc-qcom-sdm845/call_audio_idle_suspend_workaround.sh
|
||||
|
||||
$(find . -path './main/postmarketos-ui-*/*.sh')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-install')
|
||||
@@ -44,8 +42,9 @@ sh_files="
|
||||
|
||||
$(find . -path '.ci/*.sh')
|
||||
"
|
||||
|
||||
for file in $sh_files; do
|
||||
echo "Test with shellcheck: $file"
|
||||
cd "$DIR/../$(dirname "$file")"
|
||||
cd "$DIR/$(dirname "$file")"
|
||||
shellcheck -e SC1008 -x "$(basename "$file")"
|
||||
done
|
||||
@@ -17,12 +17,15 @@ def deviceinfo_obsolete(info):
|
||||
Test for obsolete options used in the deviceinfo file. They must still be
|
||||
defined in pmbootstrap's config/__init__.py.
|
||||
"""
|
||||
obsolete_options = ["weston_pixman_type"]
|
||||
obsolete_options = [
|
||||
"usb_rndis_function",
|
||||
"weston_pixman_type",
|
||||
]
|
||||
for option in obsolete_options:
|
||||
if info[option]:
|
||||
raise RuntimeError("option '" + option + "' is obsolete, please"
|
||||
" remove it (reasons for removal are at"
|
||||
" <https://postmarketos.org/deviceinfo>)")
|
||||
if option in info and info[option]:
|
||||
raise RuntimeError(f"option {option} is obsolete, please rename"
|
||||
" or remove it (see reasons for removal of at"
|
||||
" https://postmarketos.org/deviceinfo)")
|
||||
|
||||
|
||||
def test_deviceinfo(args):
|
||||
|
||||
@@ -15,8 +15,10 @@ def test_aports_firmware(args):
|
||||
"""
|
||||
|
||||
excluded = [
|
||||
"firmware-motorola-ali", # Depends on firmware-qcom-adreno-a530
|
||||
"firmware-motorola-potter", # Depends on soc-qcom-msm8916-ucm
|
||||
"firmware-oneplus-msm8998", # Depends on soc-qcom-sdm845-nonfree-firmware
|
||||
"firmware-xiaomi-sagit", # Depends on soc-qcom-sdm845-nonfree-firmware
|
||||
"firmware-samsung-baffinlite", # Depends on firmware-aosp-broadcom-wlan
|
||||
"firmware-samsung-crespo", # Depends on firmware-aosp-broadcom-wlan
|
||||
"firmware-samsung-maguro", # Depends on firmware-aosp-broadcom-wlan
|
||||
@@ -41,3 +43,8 @@ def test_aports_firmware(args):
|
||||
raise RuntimeError(f"{aport_name}: \"!tracedeps\" missing in"
|
||||
" options= line. The tracedeps option is superfluous"
|
||||
" for firmware packages.")
|
||||
|
||||
if "noarch" in apkbuild["arch"]:
|
||||
raise RuntimeError(f"{aport_name}: \"arch\" must not be \"noarch\"!"
|
||||
" Please limit this firmware package to the"
|
||||
" required architectures only!")
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
import pmb.parse._apkbuild
|
||||
|
||||
|
||||
def apkbuild_check_provides(path, apkbuild, version, pkgname, subpkgname=None):
|
||||
"""
|
||||
Verify that a package or subpackage is using provides correctly.
|
||||
|
||||
:param path: to the APKBUILD for the error message
|
||||
:param apkbuild: either the full return of pmb.parse.apkbuild() or a
|
||||
subpackage of it (apkbuild["subpackages"][$subpkgname])
|
||||
:param version: like 1.0.0-r3 so we can check against it
|
||||
:param pkgname: package name
|
||||
:param subpkgname: subpackage name, if we are looking at a subpackage
|
||||
:returns: list of error strings
|
||||
"""
|
||||
name = pkgname
|
||||
if subpkgname:
|
||||
name = f"{pkgname}:{subpkgname}"
|
||||
|
||||
logging.info(f"{name}: checking provides")
|
||||
ret = []
|
||||
|
||||
if not apkbuild["provides"]:
|
||||
return ret
|
||||
|
||||
for provide in apkbuild["provides"]:
|
||||
# Having provides entries without version is valid if the
|
||||
# provider_priorty is also set (pma#1766)
|
||||
if apkbuild["provider_priority"]:
|
||||
continue
|
||||
# Otherwise the version =$pkgver-r$pkgrel needs to be set. pmbootstrap
|
||||
# already replaces the variables, so we check against the inserted
|
||||
# values here.
|
||||
if not provide.endswith(f"={version}"):
|
||||
provide_no_ver = provide.split("=", 1)[0]
|
||||
|
||||
error = f"error in {path}:\n"
|
||||
if subpkgname:
|
||||
error += f"in subpackage:\n {subpkgname}\n"
|
||||
else:
|
||||
error += f"in package:\n {pkgname}\n"
|
||||
error += f"broken provides entry:\n {provide_no_ver}\n"
|
||||
error += "\n"
|
||||
error += "This provides entry needs to be changed to"
|
||||
error += f" '{provide_no_ver}=$pkgver-r$pkgrel'"
|
||||
error += " (do not replace the variables, without '').\n"
|
||||
error += "\n"
|
||||
error += "If you know what you are doing and didn't add the"
|
||||
error += " version on purpose, you also need to set a"
|
||||
error += " provider_priority (pma#1766).\n"
|
||||
error += "Reference:"
|
||||
error += " https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#provides"
|
||||
ret += [error]
|
||||
return ret
|
||||
|
||||
|
||||
def test_provides(args):
|
||||
errors = []
|
||||
for path in glob.iglob(f"{args.aports}/**/APKBUILD", recursive=True):
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
pkgname = apkbuild["pkgname"]
|
||||
version = f"{apkbuild['pkgver']}-r{apkbuild['pkgrel']}"
|
||||
path_rel = os.path.relpath(path, args.aports)
|
||||
errors += apkbuild_check_provides(path_rel, apkbuild, version, pkgname)
|
||||
|
||||
for subpkg, subpkg_data in apkbuild["subpackages"].items():
|
||||
if not subpkg_data:
|
||||
# default packaging function like -doc
|
||||
continue
|
||||
errors += apkbuild_check_provides(path_rel, subpkg_data, version,
|
||||
pkgname, subpkg)
|
||||
|
||||
if errors:
|
||||
for error in errors:
|
||||
logging.error(error)
|
||||
raise RuntimeError(f"test_provides failed with {len(errors)} errors")
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2021 Oliver Smith
|
||||
# Copyright 2022 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Various checks on source= in the APKBUILDs
|
||||
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
import os
|
||||
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.parse
|
||||
@@ -21,12 +23,13 @@ def parse_source_from_checksums(args, apkbuild_path):
|
||||
to parse shell code (like in postmarketos-base).
|
||||
|
||||
:param apkbuild_path: full path to the APKBUILD
|
||||
:returns: list of parsed "source" files, e.g.:
|
||||
["first.patch", "second.patch"]
|
||||
:returns: dict of parsed "source" filenames and checksums, e.g.:
|
||||
{"first.patch": "b4dc4f3…",
|
||||
"second.patch": "b4dc4f3…"}
|
||||
"""
|
||||
start = 'sha512sums="'
|
||||
in_block = False
|
||||
ret = []
|
||||
ret = {}
|
||||
|
||||
with open(apkbuild_path, encoding="utf-8") as handle:
|
||||
for line in handle.readlines():
|
||||
@@ -43,18 +46,21 @@ def parse_source_from_checksums(args, apkbuild_path):
|
||||
continue
|
||||
|
||||
try:
|
||||
_, filename = line.rstrip().split(" ", 2)
|
||||
checksum, filename = line.rstrip().split(" ", 2)
|
||||
except ValueError:
|
||||
raise ValueError("Failed to parse checksums. Try to delete the"
|
||||
" checksums and generate them again with"
|
||||
f" 'pmbootstrap checksum': {apkbuild_path}")
|
||||
|
||||
# Cut off 'sha512sums="' if the first checksum is in that line
|
||||
if checksum.startswith(start):
|
||||
checksum = checksum[len(start):]
|
||||
|
||||
# Find end
|
||||
if filename.endswith('"'):
|
||||
ret += [filename[:-1]]
|
||||
break
|
||||
filename = filename[:-1]
|
||||
|
||||
ret += [filename]
|
||||
ret[filename] = checksum
|
||||
return ret
|
||||
|
||||
|
||||
@@ -63,6 +69,10 @@ def test_aports_unreferenced_files(args):
|
||||
Raise an error if an unreferenced file is found
|
||||
"""
|
||||
for apkbuild_path in glob.iglob(args.aports + "/**/APKBUILD", recursive=True):
|
||||
# pmbootstrap parser has some issues with complicated APKBUILDs, skip those.
|
||||
if apkbuild_path.startswith(args.aports + "/cross/"):
|
||||
continue
|
||||
|
||||
apkbuild = pmb.parse.apkbuild(apkbuild_path)
|
||||
sources_chk = parse_source_from_checksums(args, apkbuild_path)
|
||||
|
||||
@@ -75,9 +85,6 @@ def test_aports_unreferenced_files(args):
|
||||
continue
|
||||
subpackage_installs += subpackage.get("install", [])
|
||||
subpackage_triggers += subpackage.get("triggers", [])
|
||||
print(subpackage_installs)
|
||||
if "device-nokia-n900-nonfree-firmware.post-install" in subpackage_installs:
|
||||
print(subpackage)
|
||||
|
||||
# Collect trigger files
|
||||
trigger_sources = []
|
||||
@@ -96,3 +103,50 @@ def test_aports_unreferenced_files(args):
|
||||
and rel_file_path not in subpackage_installs \
|
||||
and rel_file_path not in trigger_sources:
|
||||
raise RuntimeError(f"{apkbuild_path}: found unreferenced file: {rel_file_path}")
|
||||
|
||||
|
||||
def test_distfiles_conflict(args):
|
||||
"""
|
||||
Make sure that each filename mentioned in any source= of any APKBUILD
|
||||
always has the same checksum. This is important because apk caches
|
||||
downloaded source files in a flat distfiles directory. So if two APKBUILDs
|
||||
both download a file with the same filename but different checksum, and the
|
||||
user builds both after each other, abuild will fail on the second build
|
||||
with a checksum error.
|
||||
"""
|
||||
source_all = {}
|
||||
for apkbuild_path in glob.iglob(f"{args.aports}/**/APKBUILD", recursive=True):
|
||||
source = parse_source_from_checksums(args, apkbuild_path)
|
||||
dir_path = os.path.dirname(apkbuild_path)
|
||||
apkbuild_rel = os.path.relpath(apkbuild_path, args.aports)
|
||||
for filename, checksum in source.items():
|
||||
# Files bundled with the APKBUILD don't get copied to the distfiles
|
||||
# cache, so not relevant for this check. Use glob.glob here and not
|
||||
# iglob, because we don't want an iterator.
|
||||
if glob.glob(f"{dir_path}/**/{filename}", recursive=True):
|
||||
continue
|
||||
|
||||
# First time seeing this file
|
||||
if filename not in source_all:
|
||||
source_all[filename] = {"checksum": checksum,
|
||||
"apkbuild_rel": apkbuild_rel}
|
||||
continue
|
||||
|
||||
# Saw this file already with same checksum
|
||||
if checksum == source_all[filename]["checksum"]:
|
||||
continue
|
||||
|
||||
# Saw this file already with different checksum
|
||||
logging.error("")
|
||||
logging.error(f"ERROR: the source file '{filename}' has different"
|
||||
" checksums in the following files:")
|
||||
logging.error(f"- {source_all[filename]['apkbuild_rel']}:")
|
||||
logging.error(f" {source_all[filename]['checksum']}")
|
||||
logging.error(f"- {apkbuild_rel}:")
|
||||
logging.error(f" {checksum}")
|
||||
logging.error("")
|
||||
logging.error("Fix this by setting a different target filename in"
|
||||
" the package you modified:")
|
||||
logging.error("https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#source")
|
||||
logging.error("")
|
||||
raise RuntimeError(f"Conflict with source file '{filename}'")
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh -e
|
||||
# Description: verify devices are documented in the wiki
|
||||
# Options: native
|
||||
# Run natively so we don't need to set up a chroot, python3 is the only dep.
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
apk -q add \
|
||||
python3
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
set -x
|
||||
.ci/lib/check_devices_in_wiki.py --booting
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
# Top-most EditorConfig file.
|
||||
root = true
|
||||
|
||||
[**/APKBUILD]
|
||||
[{**.{md,ini,sh,rules,nft},**/APKBUILD}]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
@@ -20,7 +20,6 @@ dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
|
||||
+44
-42
@@ -3,7 +3,7 @@
|
||||
# global settings
|
||||
image: alpine:latest
|
||||
after_script:
|
||||
- .ci/move_logs.sh $CI_PROJECT_DIR
|
||||
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
@@ -31,13 +31,12 @@ wiki:
|
||||
- merge_requests
|
||||
changes:
|
||||
- device/*/device-*/*
|
||||
before_script:
|
||||
- apk -q add python3
|
||||
script:
|
||||
- .ci/check_devices_in_wiki.py --booting
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/wiki.sh
|
||||
|
||||
# testcases linting
|
||||
testcases-linting:
|
||||
flake8:
|
||||
stage: lint
|
||||
<<: *only-default
|
||||
only:
|
||||
@@ -49,29 +48,35 @@ testcases-linting:
|
||||
before_script:
|
||||
- apk -q add py-flake8
|
||||
script:
|
||||
- flake8 --ignore E501,F401,E722,W504,W605
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/flake8.sh
|
||||
|
||||
# shellcheck
|
||||
shellcheck:
|
||||
# shellcheck and various grep checks
|
||||
shellcheck-grep:
|
||||
stage: lint
|
||||
<<: *only-default
|
||||
image: alpine:edge
|
||||
before_script:
|
||||
- apk -q add shellcheck
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/shellcheck.sh
|
||||
- .ci/grep.sh
|
||||
|
||||
# aports checks (generic)
|
||||
aports-static:
|
||||
editor-config:
|
||||
stage: lint
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
- sh ./install_pmbootstrap.sh pytest
|
||||
image: alpine:edge
|
||||
script:
|
||||
- su pmos -c ".ci/run_testcases.sh"
|
||||
- su pmos -c ".ci/check_changed_aports_versions.py"
|
||||
- su pmos -c ".ci/check-dtb-install-location.sh"
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/ec.sh
|
||||
|
||||
# aports checks (generic)
|
||||
pytest-commits:
|
||||
stage: lint
|
||||
<<: *only-default
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/pytest.sh
|
||||
- .ci/commits.sh
|
||||
artifacts:
|
||||
when: on_failure
|
||||
paths:
|
||||
@@ -80,26 +85,12 @@ aports-static:
|
||||
- pmbootstrap.cfg
|
||||
expire_in: 1 week
|
||||
|
||||
distfile-check:
|
||||
stage: lint
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- apk -q add make findutils
|
||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/archive/master/ci-common-master.tar.bz2"
|
||||
- tar -xf ci-common-master.tar.bz2
|
||||
- mv ci-common-master/distfile-check/*.sh ci-common-master/distfile-check/Makefile .
|
||||
- rm -r ci-common-master ci-common-master.tar.bz2
|
||||
script:
|
||||
- make -j999
|
||||
|
||||
# APKBUILD linting
|
||||
aport-lint:
|
||||
stage: lint
|
||||
before_script:
|
||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
- sh ./install_pmbootstrap.sh
|
||||
script:
|
||||
- su pmos -c ".ci/apkbuild-linting.py"
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/apkbuild-lint.sh
|
||||
only:
|
||||
- merge_requests
|
||||
allow_failure: true
|
||||
@@ -114,11 +105,9 @@ kernel-kconfig:
|
||||
changes:
|
||||
- device/*/linux-*/config-*
|
||||
- main/linux-*/config-*
|
||||
before_script:
|
||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
- sh ./install_pmbootstrap.sh pytest
|
||||
script:
|
||||
- su pmos -c "pmbootstrap kconfig check"
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/kconfig.sh
|
||||
|
||||
# MR settings
|
||||
# (Checks for "Allow commits from members who can merge to the target branch")
|
||||
@@ -137,10 +126,8 @@ mr-settings:
|
||||
stage: build
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
- sh ./install_pmbootstrap.sh
|
||||
script:
|
||||
- .ci/build.sh
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
after_script:
|
||||
- cp -r /home/pmos/.local/var/pmbootstrap/packages/ packages/ || true
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
@@ -150,15 +137,30 @@ mr-settings:
|
||||
|
||||
build-x86_64:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-x86_64.sh
|
||||
|
||||
build-x86:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-x86.sh
|
||||
|
||||
build-aarch64:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-aarch64.sh
|
||||
|
||||
build-armv7:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-armv7.sh
|
||||
|
||||
build-armhf:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-armhf.sh
|
||||
|
||||
build-riscv64:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-riscv64.sh
|
||||
+80
-18
@@ -1,21 +1,83 @@
|
||||
# https://docs.gitlab.com/ee/user/project/code_owners.html
|
||||
|
||||
device/*/*-htc-golfu/ @Newbyte
|
||||
device/*/*-pine64-pinephone/ @craftyguy @milesalan @bshah @proycon @anjandev @StacyHarper
|
||||
device/*/*-htc-m8qlul/ @Newbyte
|
||||
device/*/*-purism-librem5/ @craftyguy @bshah
|
||||
device/*/device-lg-judyln/ @Newbyte
|
||||
device/*/device-samsung-m0/ @Newbyte
|
||||
device/*/linux-postmarketos-exynos4/ @Newbyte
|
||||
device/*/linux-postmarketos-msm8939/ @Newbyte
|
||||
device/*/linux-postmarketos-stericsson/ @Newbyte
|
||||
device/community/*-qcom-sdm845 @calebccff @joelselvaraj
|
||||
device/community/*-xiaomi-berrylium @joelselvaraj
|
||||
device/community/device-oneplus-enchilada @calebccff
|
||||
device/community/device-oneplus-fajita @calebccff
|
||||
main/osk-sdl/ @craftyguy
|
||||
main/postmarketos-ui-plasma-mobile/ @bshah
|
||||
main/ttyescape @calebccff
|
||||
temp/u-boot-librem5/ @craftyguy @bshah
|
||||
device/*/*-htc-golfu/ @Newbyte
|
||||
device/*/*-pine64-pinephone/ @craftyguy @milesalan @bshah @proycon @anjandev @StacyHarper
|
||||
device/*/*-htc-m8qlul/ @Newbyte
|
||||
device/*/*-purism-librem5/ @craftyguy @bshah
|
||||
device/*/device-lg-judyln/ @Newbyte
|
||||
device/*/device-samsung-m0/ @Newbyte
|
||||
device/*/linux-postmarketos-exynos4/ @Newbyte
|
||||
device/*/linux-postmarketos-msm8939/ @Newbyte
|
||||
device/*/linux-postmarketos-stericsson/ @Newbyte
|
||||
device/*/*-qcom-sdm845/ @sdm845-mainline
|
||||
device/*/*-xiaomi-berrylium/ @joelselvaraj
|
||||
device/*/device-oneplus-enchilada/ @calebccff
|
||||
device/*/device-oneplus-fajita/ @calebccff
|
||||
device/*/firmware-oneplus-sdm845/ @calebccff
|
||||
device/*/device-shift-axolotl/ @amartinz @calebccff @dylanvanassche
|
||||
device/*/*-lenovo-a6010/ @jenneron
|
||||
device/*/*-lenovo-a6000/ @jenneron
|
||||
device/*/device-microsoft-surface-rt/ @jenneron
|
||||
device/*/device-google-fennel/ @jenneron
|
||||
device/*/device-google-veyron-minnie/ @jenneron
|
||||
device/*/device-google-burnet/ @jenneron
|
||||
device/*/device-google-elm/ @jenneron
|
||||
device/*/device-google-nyan-big/ @jenneron
|
||||
device/*/device-google-peach-pi/ @jenneron
|
||||
device/*/device-google-veyron-speedy/ @jenneron
|
||||
device/*/linux-google-veyron/ @jenneron
|
||||
device/*/u-boot-peach-pi/ @jenneron
|
||||
device/*/device-google-cozmo/ @jenneron
|
||||
device/*/u-boot-veyron-speedy/ @jenneron
|
||||
device/*/device-google-juniper/ @jenneron @binarycraft
|
||||
device/*/u-boot-peach-pit/ @jenneron
|
||||
device/*/device-google-damu/ @jenneron
|
||||
device/*/u-boot-nyan-4gb/ @jenneron
|
||||
device/*/device-google-kenzo/ @jenneron
|
||||
device/*/device-google-kodama/ @jenneron
|
||||
device/*/u-boot-snow/ @jenneron
|
||||
device/*/device-google-kevin/ @jenneron
|
||||
device/*/linux-postmarketos-exynos5/ @jenneron @Grimler
|
||||
device/*/device-google-krane/ @jenneron
|
||||
device/*/soc-mediatek-mt8183/ @jenneron
|
||||
device/*/u-boot-veyron-minnie/ @jenneron
|
||||
device/*/device-google-fennel14/ @jenneron
|
||||
device/*/linux-google-nyan/ @jenneron
|
||||
device/*/device-google-willow/ @jenneron
|
||||
device/*/linux-postmarketos-mediatek-mt8173/ @jenneron
|
||||
device/*/linux-postmarketos-mediatek-mt8183/ @jenneron @binarycraft
|
||||
device/*/device-google-nyan-blaze/ @jenneron
|
||||
device/*/firmware-powervr-gx6250/ @jenneron
|
||||
device/*/device-google-hana/ @jenneron
|
||||
device/*/device-google-snow/ @jenneron
|
||||
device/*/device-google-kappa/ @jenneron
|
||||
device/*/u-boot-nyan-2gb/ @jenneron
|
||||
device/*/device-google-veyron-jerry/ @jenneron
|
||||
device/*/device-google-kakadu/ @jenneron
|
||||
device/*/firmware-google-veyron-brcm/ @jenneron
|
||||
device/*/device-google-peach-pit/ @jenneron
|
||||
device/*/device-lg-judyp/ @jenneron
|
||||
device/*/device-asus-tf201/ @clamor95
|
||||
device/*/device-asus-tf300t/ @clamor95
|
||||
device/*/device-asus-tf300tg/ @clamor95
|
||||
device/*/device-asus-tf700t/ @clamor95
|
||||
device/*/device-lg-p895/ @clamor95
|
||||
device/*/firmware-asus-transformer/ @clamor95 @jenneron
|
||||
device/*/firmware-lg-x3/ @clamor95
|
||||
device/*/linux-postmarketos-grate/ @clamor95 @jenneron
|
||||
device/*/device-samsung-chagallwifi @Grimler
|
||||
device/*/device-odroid-xu4 @Grimler
|
||||
device/*/device-samsung-klimtlte @Grimler
|
||||
device/*/linux-samsung-klimtlte @Grimler
|
||||
device/*/firmware-odroid-xu4 @Grimler
|
||||
device/*/linux-samsung-chagallwifi @Grimler
|
||||
|
||||
# vim: ts=4 sw=4 et
|
||||
main/postmarketos-update-depthcharge-kernel/ @jenneron
|
||||
main/osk-sdl/ @craftyguy
|
||||
main/postmarketos-ui-plasma-mobile/ @bshah
|
||||
main/ttyescape @calebccff
|
||||
temp/u-boot-librem5/ @craftyguy @bshah
|
||||
temp/alsa-ucm-conf-google-kukui/ @jenneron @binarycraft
|
||||
temp/alsa-ucm-conf-google-gru/ @jenneron
|
||||
|
||||
# vim: ts=8 sw=4 et
|
||||
@@ -5,4 +5,4 @@ Helpful resources:
|
||||
* [APKBUILD reference](https://wiki.alpinelinux.org/wiki/APKBUILD_Reference)
|
||||
* [Alpine Linux aports](https://gitlab.alpinelinux.org/alpine/aports/)
|
||||
* [Alpine Linux package search](https://pkgs.alpinelinux.org/packages)
|
||||
* [postmarketOS package search](https://pkgs.postmarketos.org/packages)
|
||||
* [postmarketOS package search](https://pkgs.postmarketos.org/packages)
|
||||
+7
-1
@@ -8,8 +8,14 @@ branch_pmaports=master
|
||||
branch_aports=master
|
||||
mirrordir_alpine=edge
|
||||
|
||||
[v22.06]
|
||||
[v22.12]
|
||||
description=Latest release / Recommended for best stability
|
||||
branch_pmaports=v22.12
|
||||
branch_aports=3.17-stable
|
||||
mirrordir_alpine=v3.17
|
||||
|
||||
[v22.06]
|
||||
description=Old release (supported until 2023-01-18)
|
||||
branch_pmaports=v22.06
|
||||
branch_aports=3.16-stable
|
||||
mirrordir_alpine=v3.16
|
||||
|
||||
@@ -8,7 +8,7 @@ CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-aarch64
|
||||
pkgver=2.39
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="Tools necessary to build programs for aarch64 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends_build="bison flex texinfo"
|
||||
@@ -59,6 +59,19 @@ build() {
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
case "$CARCH" in
|
||||
riscv64)
|
||||
# binutils creates empty textrels here
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=25694
|
||||
local no_textrels=""
|
||||
;;
|
||||
*)
|
||||
# set -z text by default
|
||||
# this is the default for linkers such as ld.lld too
|
||||
local no_textrels="--enable-textrel-check=error"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
@@ -103,6 +116,7 @@ build() {
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
$no_textrels \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls \
|
||||
|
||||
@@ -8,7 +8,7 @@ CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-armhf
|
||||
pkgver=2.39
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="Tools necessary to build programs for armhf targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends_build="bison flex texinfo"
|
||||
@@ -59,6 +59,19 @@ build() {
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
case "$CARCH" in
|
||||
riscv64)
|
||||
# binutils creates empty textrels here
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=25694
|
||||
local no_textrels=""
|
||||
;;
|
||||
*)
|
||||
# set -z text by default
|
||||
# this is the default for linkers such as ld.lld too
|
||||
local no_textrels="--enable-textrel-check=error"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
@@ -103,6 +116,7 @@ build() {
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
$no_textrels \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls \
|
||||
|
||||
@@ -8,7 +8,7 @@ CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-armv7
|
||||
pkgver=2.39
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="Tools necessary to build programs for armv7 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends_build="bison flex texinfo"
|
||||
@@ -59,6 +59,19 @@ build() {
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
case "$CARCH" in
|
||||
riscv64)
|
||||
# binutils creates empty textrels here
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=25694
|
||||
local no_textrels=""
|
||||
;;
|
||||
*)
|
||||
# set -z text by default
|
||||
# this is the default for linkers such as ld.lld too
|
||||
local no_textrels="--enable-textrel-check=error"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
@@ -103,6 +116,7 @@ build() {
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
$no_textrels \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls \
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
From bbf05b742fde518fb97c789b043fe0d3aaf549f0 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Tue, 21 Sep 2021 14:53:13 +0000
|
||||
Subject: [PATCH] Revert "PR25882, .gnu.attributes are not checked for shared
|
||||
libraries"
|
||||
|
||||
This revert is needed to avoid wrongly tagging objects with the incompatible
|
||||
IBM long double ABI, which is not supported by musl and will result in
|
||||
linking errors if used.
|
||||
|
||||
This reverts commit a8acd6eeb6dc2cc5460ece90f90ebe36b56b20ba.
|
||||
---
|
||||
bfd/elf32-tic6x.c | 3 ---
|
||||
ld/ldlang.c | 10 ++++------
|
||||
2 files changed, 4 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
|
||||
index 5754f3cb860..3ad1d612749 100644
|
||||
--- a/bfd/elf32-tic6x.c
|
||||
+++ b/bfd/elf32-tic6x.c
|
||||
@@ -3735,9 +3735,6 @@ elf32_tic6x_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
|
||||
|
||||
case Tag_ABI_PIC:
|
||||
case Tag_ABI_PID:
|
||||
- /* Don't transfer these tags from dynamic objects. */
|
||||
- if ((ibfd->flags & DYNAMIC) != 0)
|
||||
- continue;
|
||||
if (out_attr[i].i > in_attr[i].i)
|
||||
out_attr[i].i = in_attr[i].i;
|
||||
break;
|
||||
diff --git a/ld/ldlang.c b/ld/ldlang.c
|
||||
index 37b64c89ee1..f13beaef9d9 100644
|
||||
--- a/ld/ldlang.c
|
||||
+++ b/ld/ldlang.c
|
||||
@@ -7071,13 +7071,11 @@ lang_check (void)
|
||||
bfd_printable_name (input_bfd), input_bfd,
|
||||
bfd_printable_name (link_info.output_bfd));
|
||||
}
|
||||
-
|
||||
- /* If the input bfd has no contents, it shouldn't set the
|
||||
- private data of the output bfd. */
|
||||
- else if (!file->flags.just_syms
|
||||
- && ((input_bfd->flags & DYNAMIC) != 0
|
||||
- || bfd_count_sections (input_bfd) != 0))
|
||||
+ else if (bfd_count_sections (input_bfd))
|
||||
{
|
||||
+ /* If the input bfd has no contents, it shouldn't set the
|
||||
+ private data of the output bfd. */
|
||||
+
|
||||
bfd_error_handler_type pfn = NULL;
|
||||
|
||||
/* If we aren't supposed to warn about mismatched input
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
# Automatically generated aport, do not edit!
|
||||
# Generator: pmbootstrap aportgen binutils-riscv64
|
||||
# Based on: main/binutils
|
||||
|
||||
|
||||
CTARGET_ARCH=riscv64
|
||||
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-riscv64
|
||||
pkgver=2.39
|
||||
pkgrel=3
|
||||
pkgdesc="Tools necessary to build programs for riscv64 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends_build="bison flex texinfo"
|
||||
makedepends_host="zlib-dev"
|
||||
makedepends="$makedepends_build $makedepends_host"
|
||||
arch="x86_64"
|
||||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages="binutils-dev binutils-doc"
|
||||
source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz
|
||||
binutils-ld-fix-static-linking.patch
|
||||
gold-mips.patch
|
||||
ld-bfd-mips.patch
|
||||
0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
|
||||
binutils-mips-disable-assert.patch
|
||||
CVE-2022-38533.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
subpackages="$subpackages binutils-gold"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
pkgname="binutils-$CTARGET_ARCH"
|
||||
subpackages=""
|
||||
sonameprefix="binutils:"
|
||||
fi
|
||||
|
||||
# secfixes:
|
||||
# 2.39-r2:
|
||||
# - CVE-2022-38533
|
||||
# 2.39-r0:
|
||||
# - CVE-2022-38126
|
||||
# 2.35.2-r1:
|
||||
# - CVE-2021-3487
|
||||
# 2.32-r0:
|
||||
# - CVE-2018-19931
|
||||
# - CVE-2018-19932
|
||||
# - CVE-2018-20002
|
||||
# - CVE-2018-20712
|
||||
# 2.28-r1:
|
||||
# - CVE-2017-7614
|
||||
|
||||
build() {
|
||||
local _sysroot=/
|
||||
local _cross_configure="--enable-install-libiberty --enable-shared"
|
||||
local _arch_configure=""
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
case "$CARCH" in
|
||||
riscv64)
|
||||
# binutils creates empty textrels here
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=25694
|
||||
local no_textrels=""
|
||||
;;
|
||||
*)
|
||||
# set -z text by default
|
||||
# this is the default for linkers such as ld.lld too
|
||||
local no_textrels="--enable-textrel-check=error"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
_plugin_configure="--disable-plugins"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
_gold_configure="--enable-gold"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "x86_64" ]; then
|
||||
_arch_configure="--enable-targets=x86_64-pep"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "riscv64" ]; then
|
||||
_gold_configure="--disable-gold"
|
||||
fi
|
||||
|
||||
case "$CTARGET_ARCH" in
|
||||
mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;;
|
||||
*) _hash_style_configure="--enable-default-hash-style=gnu" ;;
|
||||
esac
|
||||
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--target=$CTARGET \
|
||||
--with-build-sysroot="$CBUILDROOT" \
|
||||
--with-sysroot=$_sysroot \
|
||||
--prefix=/usr \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--disable-multilib \
|
||||
--disable-gprofng \
|
||||
--enable-ld=default \
|
||||
$_gold_configure \
|
||||
--enable-64-bit-bfd \
|
||||
$_plugin_configure \
|
||||
--enable-relro \
|
||||
--enable-deterministic-archives \
|
||||
--enable-default-execstack=no \
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
$no_textrels \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls \
|
||||
--with-mmap \
|
||||
--with-system-zlib
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
make install DESTDIR="$pkgdir"
|
||||
if [ -d "$pkgdir"/usr/lib64 ]; then
|
||||
mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
|
||||
rmdir "$pkgdir"/usr/lib64
|
||||
fi
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# creating cross tools: remove any files that would conflict
|
||||
# with the native tools, or other cross tools
|
||||
rm -r "${pkgdir:?}"/usr/share
|
||||
rm -f "$pkgdir"/usr/lib/libiberty.a
|
||||
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
|
||||
fi
|
||||
}
|
||||
|
||||
libs() {
|
||||
pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib
|
||||
mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
gold() {
|
||||
pkgdesc="GNU binutils - gold linker"
|
||||
|
||||
if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
|
||||
mkdir -p "$subpkgdir"/usr/bin
|
||||
mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
|
||||
fi
|
||||
mkdir -p "$subpkgdir"/usr/$CTARGET/bin
|
||||
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz
|
||||
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
|
||||
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch
|
||||
314d2ef9071c89940aa6c8118e8a1e2f191a5d0a4bf596da1ad9cc84f884d8bc7dea8bd7b9fc3f8f1bddd3fd41c6eb017e1e804044b3bf084df1ed9e6e095e2d ld-bfd-mips.patch
|
||||
70ec22bd72ef6dddecfd970613387dd4a8cdc8730dd3cbf03d5a0c3a7c4d839383167bb06dad21bf7c235329fd44b5dc4aefe762f68544f17155cf002bf1be4a 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
|
||||
609cd90d8b334eb309f586b17b9d335a08d3dbb6def7c3eb5c010028fcb681674031e5b9d853aa7a39a50304356a86afc184b85562b3f228f8197f4d29395c8f binutils-mips-disable-assert.patch
|
||||
631726e557524633ace39c597acbc5ac39bfd25f7b292eee1f0b2a80a503f4ff799f027757d12d5a24b2fa3c07c7e14602d8a86d96e19876d6d0d5d1a02817e7 CVE-2022-38533.patch
|
||||
"
|
||||
@@ -0,0 +1,22 @@
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff_plain;f=bfd%2Fcoffcode.h;h=52027981c3f052d98e043cd0c877f0bb5da97c7f;hp=67aaf158ca1829fe63f0065f31a0b1009b227b36;hb=ef186fe54aa6d281a3ff8a9528417e5cc614c797;hpb=80075150727d653c39e9d037e15c6b87dcef08cd
|
||||
|
||||
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
|
||||
index 67aaf158ca1..52027981c3f 100644
|
||||
--- a/bfd/coffcode.h
|
||||
+++ b/bfd/coffcode.h
|
||||
@@ -4302,10 +4302,13 @@ coff_set_section_contents (bfd * abfd,
|
||||
|
||||
rec = (bfd_byte *) location;
|
||||
recend = rec + count;
|
||||
- while (rec < recend)
|
||||
+ while (recend - rec >= 4)
|
||||
{
|
||||
+ size_t len = bfd_get_32 (abfd, rec);
|
||||
+ if (len == 0 || len > (size_t) (recend - rec) / 4)
|
||||
+ break;
|
||||
+ rec += len * 4;
|
||||
++section->lma;
|
||||
- rec += bfd_get_32 (abfd, rec) * 4;
|
||||
}
|
||||
|
||||
BFD_ASSERT (rec == recend);
|
||||
@@ -0,0 +1,46 @@
|
||||
This fixes static linking for our hardened toolchain
|
||||
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
|
||||
index e8126cb..9532bfb 100644
|
||||
--- a/ld/scripttempl/elf.sc
|
||||
+++ b/ld/scripttempl/elf.sc
|
||||
@@ -235,8 +235,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
|
||||
if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
|
||||
SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
|
||||
SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
|
||||
- CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
|
||||
- DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
|
||||
+ CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors"
|
||||
+ DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors"
|
||||
else
|
||||
SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
|
||||
SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
|
||||
@@ -270,15 +270,14 @@ CTOR=".ctors ${CONSTRUCTING-0} :
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
|
||||
- KEEP (*crtbegin.o(.ctors))
|
||||
- KEEP (*crtbegin?.o(.ctors))
|
||||
+ KEEP (*crtbegin*.o(.ctors))
|
||||
|
||||
/* We don't want to include the .ctor section from
|
||||
the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
|
||||
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
|
||||
+ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
${CONSTRUCTING+${CTOR_END}}
|
||||
@@ -286,9 +285,8 @@ CTOR=".ctors ${CONSTRUCTING-0} :
|
||||
DTOR=".dtors ${CONSTRUCTING-0} :
|
||||
{
|
||||
${CONSTRUCTING+${DTOR_START}}
|
||||
- KEEP (*crtbegin.o(.dtors))
|
||||
- KEEP (*crtbegin?.o(.dtors))
|
||||
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
|
||||
+ KEEP (*crtbegin*.o(.dtors))
|
||||
+ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
${CONSTRUCTING+${DTOR_END}}
|
||||
@@ -0,0 +1,14 @@
|
||||
diff -urN binutils-2.35.2.orig/bfd/elfxx-mips.c binutils-2.35.2/bfd/elfxx-mips.c
|
||||
--- binutils-2.35.2.orig/bfd/elfxx-mips.c 2021-01-30 01:38:03.000000000 -0700
|
||||
+++ binutils-2.35.2/bfd/elfxx-mips.c 2021-05-13 17:35:34.706913601 -0600
|
||||
@@ -6744,8 +6744,10 @@
|
||||
in the relocation. */
|
||||
if (h != NULL && ! SYMBOL_REFERENCES_LOCAL (info, &h->root))
|
||||
{
|
||||
+#if 0
|
||||
BFD_ASSERT (htab->root.target_os == is_vxworks
|
||||
|| h->global_got_area != GGA_NONE);
|
||||
+#endif
|
||||
indx = h->root.dynindx;
|
||||
if (SGI_COMPAT (output_bfd))
|
||||
defined_p = h->root.def_regular;
|
||||
@@ -0,0 +1,39 @@
|
||||
# DP: Fix gold on mips64 targets.
|
||||
|
||||
gold/
|
||||
|
||||
2016-08-09 Aurelien Jarno <aurelien@aurel32.net>
|
||||
|
||||
* configure.tgt: Add mips64el*-*-*|mips64le*-*-* and mips64*-*-*.
|
||||
|
||||
|
||||
--- a/gold/configure.tgt
|
||||
+++ b/gold/configure.tgt
|
||||
@@ -153,6 +153,13 @@ aarch64*-*)
|
||||
targ_big_endian=false
|
||||
targ_extra_big_endian=true
|
||||
;;
|
||||
+mips*64*el*-*-*|mips*64*le*-*-*)
|
||||
+ targ_obj=mips
|
||||
+ targ_machine=EM_MIPS_RS3_LE
|
||||
+ targ_size=64
|
||||
+ targ_big_endian=false
|
||||
+ targ_extra_big_endian=true
|
||||
+ ;;
|
||||
mips*el*-*-*|mips*le*-*-*)
|
||||
targ_obj=mips
|
||||
targ_machine=EM_MIPS_RS3_LE
|
||||
@@ -160,6 +167,13 @@ mips*el*-*-*|mips*le*-*-*)
|
||||
targ_big_endian=false
|
||||
targ_extra_big_endian=true
|
||||
;;
|
||||
+mips*64*-*-*)
|
||||
+ targ_obj=mips
|
||||
+ targ_machine=EM_MIPS
|
||||
+ targ_size=64
|
||||
+ targ_big_endian=true
|
||||
+ targ_extra_big_endian=false
|
||||
+ ;;
|
||||
mips*-*-*)
|
||||
targ_obj=mips
|
||||
targ_machine=EM_MIPS
|
||||
@@ -0,0 +1,19 @@
|
||||
--- ./ld/configure.tgt.orig
|
||||
+++ ./ld/configure.tgt
|
||||
@@ -541,12 +541,12 @@
|
||||
;;
|
||||
mips*-*-windiss) targ_emul=elf32mipswindiss
|
||||
;;
|
||||
-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
|
||||
- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
|
||||
+mips64*el-*-linux-*) targ_emul=elf64ltsmip
|
||||
+ targ_extra_emuls="elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
;;
|
||||
-mips64*-*-linux-*) targ_emul=elf32btsmipn32
|
||||
- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
|
||||
+mips64*-*-linux-*) targ_emul=elf64btsmip
|
||||
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
;;
|
||||
mips*el-*-linux-*) targ_emul=elf32ltsmip
|
||||
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
pkgname=busybox-static-aarch64
|
||||
pkgver=1.35.0
|
||||
pkgrel=27
|
||||
pkgrel=30
|
||||
|
||||
_arch="aarch64"
|
||||
_mirror="http://dl-4.alpinelinux.org/alpine/"
|
||||
@@ -32,5 +32,5 @@ package() {
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
1df3f1400461a3b9c951be9bf4ade500af9b83b4a11025bb244224cee197753d95471a8373a2f5f45d343599f632629c005dc7eba2c3d558dfbcfa56063ed110 busybox-static-1.35.0-r27-aarch64-edge.apk
|
||||
d34c0d16d77bd18548e4b2764ab4bde59611480aaaab5a47f585158a91fad413ccfb7954d5ebcf4aa6e04fdda4621832f46e8b13e313ce1fd7b4b96b3298d425 busybox-static-1.35.0-r30-aarch64-edge.apk
|
||||
"
|
||||
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
pkgname=busybox-static-armhf
|
||||
pkgver=1.35.0
|
||||
pkgrel=27
|
||||
pkgrel=30
|
||||
|
||||
_arch="armhf"
|
||||
_mirror="http://dl-4.alpinelinux.org/alpine/"
|
||||
@@ -32,5 +32,5 @@ package() {
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
cdc8cfb4e013ad0761d2417fba91f75221d97074705bcd4f8ae7a64d0badadff2340595b5d03ff0e5ca608f543ce85f4ba82820a4fd501ecb758d77432afcf90 busybox-static-1.35.0-r27-armhf-edge.apk
|
||||
805bcf5416d70db8a68a90e85dbf9728213f4e996862ce9d4af3eea35ac25bc1bf6ecddb7dc18d2881dfda59ecfbc64bfbaf148022209f26eb034a10e65494aa busybox-static-1.35.0-r30-armhf-edge.apk
|
||||
"
|
||||
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
pkgname=busybox-static-armv7
|
||||
pkgver=1.35.0
|
||||
pkgrel=27
|
||||
pkgrel=30
|
||||
|
||||
_arch="armv7"
|
||||
_mirror="http://dl-4.alpinelinux.org/alpine/"
|
||||
@@ -32,5 +32,5 @@ package() {
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
65678aa673f8fb11d0a68b7d22203ab9ce2795fb6b3d47c117f8cbecf61305316bb0b0de12812df5d7fe2febe0630fd6ca3961434ffe8051da6a0e194c133cb4 busybox-static-1.35.0-r27-armv7-edge.apk
|
||||
1beffa9f0b7a93d72b793c3ebac99a6243ca1a385064388fe6189753210775ff65bd4be30a540b5e0fa85ea795b7e3ad42cf4f9446c52ca1db285eea59a84c1a busybox-static-1.35.0-r30-armv7-edge.apk
|
||||
"
|
||||
@@ -1,42 +1,101 @@
|
||||
From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Sun, 30 Aug 2020 19:17:42 +0200
|
||||
Subject: [PATCH] gcc-go: support libucontext
|
||||
From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Mon, 19 Dec 2022 10:37:06 -0800
|
||||
Subject: [PATCH] libgo: check for makecontext in -lucontext
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch allows using gcc-go with libucontext. For this purpose,
|
||||
it unconditionally links gcc-go against -lucontext. Furthermore,
|
||||
it undefines SETCONTEXT_CLOBBERS_TLS in proc.c to prevent usage
|
||||
of makecontext/swapcontext feature that are not support by libucontext.
|
||||
Patch from Sören Tempel.
|
||||
|
||||
Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
Makefile.in | 2 +-
|
||||
libgo/runtime/proc.c | 4 ++++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
libgo/configure.ac | 3 +++
|
||||
2 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 593495e1650..c3e5d489bc0 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -52801,7 +52801,7 @@ configure-target-libgo:
|
||||
esac; \
|
||||
module_srcdir=libgo; \
|
||||
rm -f no-such-file || : ; \
|
||||
- CONFIG_SITE=no-such-file $(SHELL) \
|
||||
+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
|
||||
$$s/$$module_srcdir/configure \
|
||||
--srcdir=$${topdir}/$$module_srcdir \
|
||||
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
|
||||
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
|
||||
index 3a30748d329..a987678fa84 100644
|
||||
--- a/libgo/runtime/proc.c
|
||||
+++ b/libgo/runtime/proc.c
|
||||
@@ -66,6 +66,10 @@ static void gscanstack(G*);
|
||||
diff --git a/libgo/configure b/libgo/configure
|
||||
index 460fdad7..a607dbff 100755
|
||||
--- a/libgo/configure
|
||||
+++ b/libgo/configure
|
||||
@@ -14818,6 +14818,63 @@ fi
|
||||
|
||||
__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
|
||||
|
||||
+/* libucontext does not seem to support tlsbase, undef the macro
|
||||
+ * here to make sure we define initcontext and fixcontext as dummies. */
|
||||
+#undef SETCONTEXT_CLOBBERS_TLS
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5
|
||||
+$as_echo_n "checking for library containing makecontext... " >&6; }
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
#ifndef SETCONTEXT_CLOBBERS_TLS
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char makecontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return makecontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_makecontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_makecontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5
|
||||
+$as_echo "$ac_cv_search_makecontext" >&6; }
|
||||
+ac_res=$ac_cv_search_makecontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5
|
||||
$as_echo_n "checking for library containing sched_yield... " >&6; }
|
||||
if ${ac_cv_search_sched_yield+:} false; then :
|
||||
diff --git a/libgo/configure.ac b/libgo/configure.ac
|
||||
index 09554a37..a59aa091 100644
|
||||
--- a/libgo/configure.ac
|
||||
+++ b/libgo/configure.ac
|
||||
@@ -570,6 +570,9 @@ PTHREAD_LIBS=
|
||||
AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
|
||||
static inline void
|
||||
+dnl Test if -lucontext is required for makecontext.
|
||||
+AC_SEARCH_LIBS([makecontext], [ucontext])
|
||||
+
|
||||
dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime.
|
||||
AC_SEARCH_LIBS([sched_yield], [rt])
|
||||
AC_SEARCH_LIBS([nanosleep], [rt])
|
||||
@@ -1,45 +1,204 @@
|
||||
From 5093aa99f9cdded2e1ddf67b7139da6fac36b0a6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Mon, 19 Apr 2021 07:21:41 +0200
|
||||
Subject: [PATCH] Use generic errstr.go implementation on musl
|
||||
From b3840bdcc0eee2a4d099a9af52199944ade7acb9 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Tue, 29 Nov 2022 17:28:44 -0800
|
||||
Subject: [PATCH] syscall, runtime: always call XSI strerror_r
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc provides two version of strerror_r() depending on a feature test
|
||||
macro. The first is the XSI-compliant version which returns an int, the
|
||||
second is GNU-specific and returns a char pointer.
|
||||
This does the right thing for either glibc or musl on GNU/Linux.
|
||||
|
||||
Similarity, gcc's libgo provides two implementations of Errstr() both of
|
||||
which use strerror_r(). On Linux, it is assumed that the GNU-specific
|
||||
strerror_r version is used. However, musl only provides the
|
||||
XSI-compliant version of strerror_r. This patch enables the generic
|
||||
Errstr() implementation which also uses the XSI-compliant version of
|
||||
strerror_r.
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: If2969e131f0fae456d58b35d839d8abe191fcc59
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
||||
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
|
||||
---
|
||||
libgo/go/syscall/errstr.go | 1 -
|
||||
libgo/go/syscall/errstr_glibc.go | 2 +-
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
libgo/Makefile.am | 1 +
|
||||
libgo/Makefile.in | 6 +++++-
|
||||
libgo/go/syscall/errstr.go | 22 ++++++++-----------
|
||||
libgo/go/syscall/errstr_glibc.go | 33 ----------------------------
|
||||
libgo/runtime/go-strerror.c | 37 ++++++++++++++++++++++++++++++++
|
||||
5 files changed, 52 insertions(+), 47 deletions(-)
|
||||
delete mode 100644 libgo/go/syscall/errstr_glibc.go
|
||||
create mode 100644 libgo/runtime/go-strerror.c
|
||||
|
||||
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
|
||||
index e0a1eec5..df568743 100644
|
||||
--- a/libgo/Makefile.am
|
||||
+++ b/libgo/Makefile.am
|
||||
@@ -465,6 +465,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
|
||||
index 7bef5df9..f2f3f0fc 100644
|
||||
--- a/libgo/Makefile.in
|
||||
+++ b/libgo/Makefile.in
|
||||
@@ -247,7 +247,7 @@ am__objects_4 = runtime/aeshash.lo runtime/go-assert.lo \
|
||||
runtime/go-fieldtrack.lo runtime/go-matherr.lo \
|
||||
runtime/go-memclr.lo runtime/go-memmove.lo \
|
||||
runtime/go-memequal.lo runtime/go-nanotime.lo \
|
||||
- runtime/go-now.lo runtime/go-nosys.lo \
|
||||
+ runtime/go-now.lo runtime/go-nosys.lo runtime/go-strerror.lo \
|
||||
runtime/go-reflect-call.lo runtime/go-setenv.lo \
|
||||
runtime/go-signal.lo runtime/go-unsafe-pointer.lo \
|
||||
runtime/go-unsetenv.lo runtime/go-unwind.lo \
|
||||
@@ -917,6 +917,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
@@ -1390,6 +1391,8 @@ runtime/go-now.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-nosys.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
+runtime/go-strerror.lo: runtime/$(am__dirstamp) \
|
||||
+ runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-reflect-call.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-setenv.lo: runtime/$(am__dirstamp) \
|
||||
@@ -1457,6 +1460,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-reflect-call.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-setenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-signal.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsetenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unwind.Plo@am__quote@
|
||||
diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go
|
||||
index 6c2441d364d..8f7c5538163 100644
|
||||
index 6c2441d3..9f688e2a 100644
|
||||
--- a/libgo/go/syscall/errstr.go
|
||||
+++ b/libgo/go/syscall/errstr.go
|
||||
@@ -5,7 +5,6 @@
|
||||
@@ -4,23 +4,19 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !hurd
|
||||
-// +build !hurd
|
||||
-// +build !linux
|
||||
|
||||
-
|
||||
package syscall
|
||||
|
||||
-//sysnb strerror_r(errnum int, buf []byte) (err Errno)
|
||||
-//strerror_r(errnum _C_int, buf *byte, buflen Size_t) _C_int
|
||||
+import "internal/bytealg"
|
||||
+
|
||||
+//extern go_strerror
|
||||
+func go_strerror(_C_int, *byte, Size_t) _C_int
|
||||
|
||||
func Errstr(errnum int) string {
|
||||
- for len := 128; ; len *= 2 {
|
||||
- b := make([]byte, len)
|
||||
- errno := strerror_r(errnum, b)
|
||||
+ for size := 128; ; size *= 2 {
|
||||
+ b := make([]byte, size)
|
||||
+ errno := go_strerror(_C_int(errnum), &b[0], Size_t(len(b)))
|
||||
if errno == 0 {
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
+ i := bytealg.IndexByte(b, 0)
|
||||
// Lowercase first letter: Bad -> bad, but
|
||||
// STREAM -> STREAM.
|
||||
if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
@@ -29,7 +25,7 @@ func Errstr(errnum int) string {
|
||||
return string(b[:i])
|
||||
}
|
||||
if errno != ERANGE {
|
||||
- return "errstr failure"
|
||||
+ return "strerror_r failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/libgo/go/syscall/errstr_glibc.go b/libgo/go/syscall/errstr_glibc.go
|
||||
index 5b19e6f202d..8dc60172186 100644
|
||||
deleted file mode 100644
|
||||
index 5b19e6f2..00000000
|
||||
--- a/libgo/go/syscall/errstr_glibc.go
|
||||
+++ b/libgo/go/syscall/errstr_glibc.go
|
||||
@@ -7,7 +7,7 @@
|
||||
// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
// returns a pointer to the error message, and may not use buf at all.
|
||||
|
||||
+++ /dev/null
|
||||
@@ -1,33 +0,0 @@
|
||||
-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
|
||||
-
|
||||
-// Copyright 2010 The Go Authors. All rights reserved.
|
||||
-// Use of this source code is governed by a BSD-style
|
||||
-// license that can be found in the LICENSE file.
|
||||
-
|
||||
-// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
-// returns a pointer to the error message, and may not use buf at all.
|
||||
-
|
||||
-// +build hurd linux
|
||||
+// +build hurd !linux
|
||||
|
||||
package syscall
|
||||
|
||||
-
|
||||
-package syscall
|
||||
-
|
||||
-import "unsafe"
|
||||
-
|
||||
-//sysnb strerror_r(errnum int, b []byte) (errstr *byte)
|
||||
-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
|
||||
-
|
||||
-func Errstr(errnum int) string {
|
||||
- a := make([]byte, 128)
|
||||
- p := strerror_r(errnum, a)
|
||||
- b := (*[1000]byte)(unsafe.Pointer(p))
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
- // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||
- if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
- c := b[0] + 'a' - 'A'
|
||||
- return string(c) + string(b[1:i])
|
||||
- }
|
||||
- return string(b[:i])
|
||||
-}
|
||||
diff --git a/libgo/runtime/go-strerror.c b/libgo/runtime/go-strerror.c
|
||||
new file mode 100644
|
||||
index 00000000..13d1d91d
|
||||
--- /dev/null
|
||||
+++ b/libgo/runtime/go-strerror.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* go-strerror.c -- wrapper around XSI-compliant strerror_r.
|
||||
+
|
||||
+ Copyright 2022 The Go Authors. All rights reserved.
|
||||
+ Use of this source code is governed by a BSD-style
|
||||
+ license that can be found in the LICENSE file. */
|
||||
+
|
||||
+/* There are two version of strerror_r on GNU/Linux: a GNU-specific
|
||||
+ and an XSI-compliant version. The former version is only available
|
||||
+ on glibc. Since glibc 2.13, the XSI-compliant version is also
|
||||
+ provided by glibc if _GNU_SOURCE is not defined. Since the
|
||||
+ entirety of gofrontend is compiled with _GNU_SOURCE, this file
|
||||
+ exists to selectively undefine it and provides an alias to the
|
||||
+ XSI-compliant version of strerror_r(3). */
|
||||
+
|
||||
+#ifdef __linux__
|
||||
+
|
||||
+/* Force selection of XSI-compliant strerror_r by glibc. */
|
||||
+#undef XOPEN_SOURCE
|
||||
+#define XOPEN_SOURCE 600
|
||||
+#undef _POSIX_C_SOURCE
|
||||
+#define _POSIX_C_SOURCE 200112L
|
||||
+#undef _GNU_SOURCE
|
||||
+
|
||||
+#endif /* __linux__ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#ifndef HAVE_STRERROR_R
|
||||
+// Provided by go-nosys.c if not provided by libc itself.
|
||||
+extern int strerror_r (int, char *, size_t);
|
||||
+#endif
|
||||
+
|
||||
+int
|
||||
+go_strerror (int errnum, char *buf, size_t buflen)
|
||||
+{
|
||||
+ return strerror_r (errnum, buf, buflen);
|
||||
+}
|
||||
@@ -1,22 +1,26 @@
|
||||
From 4b6240d5301ce04b8bbc3e2152915cbc7da80584 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Wed, 28 Sep 2022 17:30:14 +0200
|
||||
Subject: [PATCH] libgo: use _off_t for mmap offset argument
|
||||
From 5e658f4659c551330ea68f5667e4f951b218f32d Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Wed, 26 Oct 2022 17:23:42 -0700
|
||||
Subject: [PATCH] runtime: use _libgo_off_t_type when calling C mmap
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
On glibc-based systems, off_t is a 32-bit type on 32-bit systems and a
|
||||
64-bit type on 64-bit systems by default. However, on systems using musl
|
||||
libc off_t is unconditionally a 64-bit type. As such, it is insufficient
|
||||
to use a uintptr type for the mmap offset parameter.
|
||||
The last argument to the C mmap function is type off_t, not uintptr.
|
||||
On some 32-bit systems, off_t is larger than uintptr.
|
||||
|
||||
Presently, the (incorrect) mmap declaration causes a libgo run-time
|
||||
failure on 32-bit musl systems (fatal error: runtime: cannot allocate
|
||||
memory). This commit fixes this run-time error.
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: Ib6f9d5bcd4734f99a72889e2282b97ec3c8fbd34
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/445735
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
libgo/go/runtime/mem_gccgo.go | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
libgo/go/runtime/mem_gccgo.go | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go
|
||||
index fa3389d8..07bf325a 100644
|
||||
index fa3389d8..1e84f4f5 100644
|
||||
--- a/libgo/go/runtime/mem_gccgo.go
|
||||
+++ b/libgo/go/runtime/mem_gccgo.go
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
@@ -24,7 +28,7 @@ index fa3389d8..07bf325a 100644
|
||||
|
||||
//extern mmap
|
||||
-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
|
||||
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _off_t) unsafe.Pointer
|
||||
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _libgo_off_t_type) unsafe.Pointer
|
||||
|
||||
//extern munmap
|
||||
func munmap(addr unsafe.Pointer, length uintptr) int32
|
||||
@@ -33,7 +37,23 @@ index fa3389d8..07bf325a 100644
|
||||
|
||||
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
|
||||
- p := sysMmap(addr, n, prot, flags, fd, off)
|
||||
+ p := sysMmap(addr, n, prot, flags, fd, _off_t(off))
|
||||
+ p := sysMmap(addr, n, prot, flags, fd, _libgo_off_t_type(off))
|
||||
if uintptr(p) == _MAP_FAILED {
|
||||
return nil, errno()
|
||||
}
|
||||
@@ -47,6 +47,7 @@ func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (u
|
||||
|
||||
// Don't split the stack as this method may be invoked without a valid G, which
|
||||
// prevents us from allocating more stack.
|
||||
+//
|
||||
//go:nosplit
|
||||
func sysAlloc(n uintptr, sysStat *sysMemStat) unsafe.Pointer {
|
||||
p, err := mmap(nil, n, _PROT_READ|_PROT_WRITE, _MAP_ANON|_MAP_PRIVATE, mmapFD, 0)
|
||||
@@ -165,6 +166,7 @@ func sysHugePage(v unsafe.Pointer, n uintptr) {
|
||||
|
||||
// Don't split the stack as this function may be invoked without a valid G,
|
||||
// which prevents us from allocating more stack.
|
||||
+//
|
||||
//go:nosplit
|
||||
func sysFree(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
|
||||
sysStat.add(-int64(n))
|
||||
@@ -0,0 +1,65 @@
|
||||
From 7b8400f902ef25ea71ed460716c1afedca357a61 Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Wed, 2 Nov 2022 12:31:36 +0100
|
||||
Subject: [PATCH] libphobos: fix undefined reference to `__cmsg_nxthdr' with
|
||||
musl
|
||||
|
||||
Ported fix from upstream.
|
||||
|
||||
Upstream: https://github.com/dlang/dmd/commit/54544260a848c8ebad5582e27ac1e09627cdfb17
|
||||
Bug-URL: https://issues.dlang.org/show_bug.cgi?id=23157
|
||||
---
|
||||
.../libdruntime/core/sys/posix/sys/socket.d | 36 +++++++++++++++++--
|
||||
1 file changed, 33 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
index c1309a68c9c..e3b536d87e7 100644
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
@@ -188,10 +188,40 @@ version (linux)
|
||||
|
||||
extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
|
||||
|
||||
- private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
|
||||
- extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ version (CRuntime_Musl)
|
||||
{
|
||||
- return __cmsg_nxthdr(msg, cmsg);
|
||||
+ extern (D)
|
||||
+ {
|
||||
+ private size_t __CMSG_LEN(inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return (cmsg.cmsg_len + size_t.sizeof -1) & cast(size_t)(~(size_t.sizeof - 1));
|
||||
+ }
|
||||
+
|
||||
+ private inout(cmsghdr)* __CMSG_NEXT(inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cmsg + __CMSG_LEN(cmsg);
|
||||
+ }
|
||||
+
|
||||
+ private inout(msghdr)* __MHDR_END(inout(msghdr)* mhdr) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cast(inout(msghdr)*)(mhdr.msg_control + mhdr.msg_controllen);
|
||||
+ }
|
||||
+
|
||||
+ inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cmsg.cmsg_len < cmsghdr.sizeof ||
|
||||
+ __CMSG_LEN(cmsg) + cmsghdr.sizeof >= __MHDR_END(msg) - cast(inout(msghdr)*)(cmsg)
|
||||
+ ? cast(inout(cmsghdr)*) null : cast(inout(cmsghdr)*) __CMSG_NEXT(cmsg);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
|
||||
+ extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return __cmsg_nxthdr(msg, cmsg);
|
||||
+ }
|
||||
}
|
||||
|
||||
extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
|
||||
--
|
||||
2.38.1
|
||||
|
||||
+18
-19
@@ -10,7 +10,7 @@ LANG_JAVA=false
|
||||
LANG_GO=false
|
||||
LANG_FORTRAN=false
|
||||
LANG_ADA=false
|
||||
options="!strip !tracedeps"
|
||||
options="!strip"
|
||||
|
||||
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
|
||||
# when this variable matches "no*"
|
||||
@@ -26,13 +26,13 @@ _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
|
||||
pkgname=gcc-aarch64
|
||||
_pkgbase=12.2.1 # must match gcc/BASE-VER
|
||||
_pkgsnap=20220924
|
||||
pkgver=${_pkgbase}_git${_pkgsnap}
|
||||
pkgver=${_pkgbase}_git$_pkgsnap
|
||||
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
|
||||
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
|
||||
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
|
||||
|
||||
pkgname=gcc-aarch64
|
||||
pkgrel=2
|
||||
pkgrel=8
|
||||
pkgdesc="Stage2 cross-compiler for aarch64"
|
||||
url="https://gcc.gnu.org"
|
||||
arch="x86_64"
|
||||
@@ -212,7 +212,7 @@ makedepends="$makedepends_build $makedepends_host"
|
||||
#
|
||||
# PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches,
|
||||
# so that they can be properly tracked and easily rebased if needed.
|
||||
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-${_pkgbase%%.*}-${_pkgsnap}.tar.xz
|
||||
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz
|
||||
0001-posix_memalign.patch
|
||||
0002-gcc-poison-system-directories.patch
|
||||
0003-specs-turn-on-Wl-z-now-by-default.patch
|
||||
@@ -258,10 +258,11 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-
|
||||
0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
|
||||
0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
|
||||
0053-libgo-make-match.sh-POSIX-shell-compatible.patch
|
||||
0054-libphobos-fix-undefined-reference-to-__cmsg_nxthdr-w.patch
|
||||
"
|
||||
|
||||
# we build out-of-tree
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-${_pkgsnap}
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
|
||||
_gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
|
||||
_gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}"
|
||||
|
||||
@@ -322,10 +323,9 @@ build() {
|
||||
|
||||
case "$CTARGET_LIBC" in
|
||||
musl)
|
||||
# musl does not support mudflap, or libsanitizer
|
||||
# libmpx uses secure_getenv and struct _libc_fpstate not present in musl
|
||||
# musl does not support libsanitizer
|
||||
# alpine musl provides libssp_nonshared.a, so we don't need libssp either
|
||||
_libc_configure="--disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer"
|
||||
_libc_configure="--disable-libssp --disable-libsanitizer"
|
||||
_symvers="--disable-symvers"
|
||||
export libat_cv_have_ifunc=no
|
||||
;;
|
||||
@@ -366,9 +366,9 @@ build() {
|
||||
--prefix=/usr
|
||||
--mandir=/usr/share/man
|
||||
--infodir=/usr/share/info
|
||||
--build=${CBUILD}
|
||||
--host=${CHOST}
|
||||
--target=${CTARGET}
|
||||
--build=$CBUILD
|
||||
--host=$CHOST
|
||||
--target=$CTARGET
|
||||
--enable-checking=release
|
||||
--disable-fixed-point
|
||||
--disable-libstdcxx-pch
|
||||
@@ -379,7 +379,6 @@ build() {
|
||||
--enable-__cxa_atexit
|
||||
--enable-default-pie
|
||||
--enable-default-ssp
|
||||
--enable-cloog-backend
|
||||
--enable-languages=$_languages
|
||||
$_arch_configure
|
||||
$_libc_configure
|
||||
@@ -435,12 +434,11 @@ package() {
|
||||
# strip debug info from some static libs
|
||||
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libgphobos.a -o -name libgdruntime.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
|
||||
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
|
||||
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
|
||||
-a -type f \
|
||||
-exec ${STRIP_FOR_TARGET} -g {} +
|
||||
-exec $STRIP_FOR_TARGET -g {} +
|
||||
|
||||
if $_libgomp; then
|
||||
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
|
||||
@@ -657,7 +655,6 @@ gdc() {
|
||||
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
|
||||
}
|
||||
|
||||
|
||||
libgo() {
|
||||
pkgdesc="Go runtime library for GCC"
|
||||
depends=
|
||||
@@ -667,8 +664,9 @@ libgo() {
|
||||
}
|
||||
|
||||
go() {
|
||||
pkgdesc="Go support for GCC"
|
||||
pkgdesc="GCC Go frontend (intended for bootstrapping community/go)"
|
||||
depends="gcc=$_gccrel libgo=$_gccrel !go"
|
||||
install="$pkgname-go.post-install"
|
||||
|
||||
# See https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E
|
||||
provides="go-bootstrap"
|
||||
@@ -795,12 +793,12 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc
|
||||
674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch
|
||||
f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch
|
||||
5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch
|
||||
3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch
|
||||
699dc3641099da6136dd3689f06c6553c03b3a85acf83a3fce1beb5425065b3e378535ca9e9100a120fdbafc34871d61c063fd5328a49cd87a15a989ed51706d 0034-Use-generic-errstr.go-implementation-on-musl.patch
|
||||
72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch
|
||||
141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch
|
||||
d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
|
||||
ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
|
||||
8bc6823f0b3c66f7b73d7ddb64ffa6930463285c2e9a14a2bc1882bcc4271144eaa1107d713294699caf9481648163cbf43921a2b8e4ac0d55c78a804bae8a3d 0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
|
||||
e9699f4721778869eb3a8fef2c679208ef5b98584892f30b0e1cb5dc1669f8158198d7792659b1b56c381baf62247d21990dcced9178547affd5d6bfb2d12548 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
|
||||
f0744c01859e67deed404c97e1870b2876935fdc467e51980373744936574c314d5d21134734c5d515e7f3cd3483ef98045b9bbcd81c568c6038fac96ffb5fa0 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
|
||||
d6dc1bfb881a313d167aaa5658790b0f55eea4336c408cfc6613dd5783440dafd0d37c43031a5f3e69be40f632e38371cd4fb6e5f0494ac4ea4d7d5025d2ae02 0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
|
||||
684c6a6d52512b973429b6e709966439ac1e174f9e79a33d4a638b452245b457b34752b4b4034ba983f6a712f86522e7adf715bab00a6603f64a12139c5b1e39 0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
|
||||
25014dfa99d96ee70ce0ad22e9f7974f0a51cc50b3b9c2db49df50774c8cd29e497ceed120486bee50be83bfb07f2009ed310eb9b0543f2795bd7359b87eadd2 0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
|
||||
@@ -811,4 +809,5 @@ c33ca2553642c2dbd1c65cd97046548f08775785a3db06d761e3bbe61398c37bc382fe132c0c3fa2
|
||||
c82d7c8d340a76df3d796565a79b0ccc04ddffef39927620e1f3719bf2dc1db101ba13aef24b46c5bc95b7bf1e31c8bda4ab0936ba4c9c5e5047ba08826c982c 0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
|
||||
eb403d8ea665fd5dc2c11faf43b055e6a3bf480a397ceee3e0ca1e38ec7d2392315f2694ed9a34ffbc99e464f2873fbbf91be8646ea4dea5d3636e3ea22fefa0 0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
|
||||
22fb6edf1ed0387e2b93839ffe6e82a7fee420950af90e91199c3488d966702fdeb1a3396d22be0c73a4051525da9349c93d070a0d83b724c83f2b268da6483f 0053-libgo-make-match.sh-POSIX-shell-compatible.patch
|
||||
9b74d0a0e4140b597708a295bcf51b93944782698470e2ba9bc0f0d4a830fc418da9624eccc85f3d65ff6d50b8ebf40cecd34d5b045db9e6c29614e981e93f92 0054-libphobos-fix-undefined-reference-to-__cmsg_nxthdr-w.patch
|
||||
"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat 1>&2 <<EOF
|
||||
*
|
||||
* gcc-go is used in Alpine for bootstrapping Go.
|
||||
* It is currently discouraged to use it for other purposes.
|
||||
*
|
||||
EOF
|
||||
@@ -1,42 +1,101 @@
|
||||
From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Sun, 30 Aug 2020 19:17:42 +0200
|
||||
Subject: [PATCH] gcc-go: support libucontext
|
||||
From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Mon, 19 Dec 2022 10:37:06 -0800
|
||||
Subject: [PATCH] libgo: check for makecontext in -lucontext
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch allows using gcc-go with libucontext. For this purpose,
|
||||
it unconditionally links gcc-go against -lucontext. Furthermore,
|
||||
it undefines SETCONTEXT_CLOBBERS_TLS in proc.c to prevent usage
|
||||
of makecontext/swapcontext feature that are not support by libucontext.
|
||||
Patch from Sören Tempel.
|
||||
|
||||
Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
Makefile.in | 2 +-
|
||||
libgo/runtime/proc.c | 4 ++++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
libgo/configure.ac | 3 +++
|
||||
2 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 593495e1650..c3e5d489bc0 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -52801,7 +52801,7 @@ configure-target-libgo:
|
||||
esac; \
|
||||
module_srcdir=libgo; \
|
||||
rm -f no-such-file || : ; \
|
||||
- CONFIG_SITE=no-such-file $(SHELL) \
|
||||
+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
|
||||
$$s/$$module_srcdir/configure \
|
||||
--srcdir=$${topdir}/$$module_srcdir \
|
||||
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
|
||||
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
|
||||
index 3a30748d329..a987678fa84 100644
|
||||
--- a/libgo/runtime/proc.c
|
||||
+++ b/libgo/runtime/proc.c
|
||||
@@ -66,6 +66,10 @@ static void gscanstack(G*);
|
||||
diff --git a/libgo/configure b/libgo/configure
|
||||
index 460fdad7..a607dbff 100755
|
||||
--- a/libgo/configure
|
||||
+++ b/libgo/configure
|
||||
@@ -14818,6 +14818,63 @@ fi
|
||||
|
||||
__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
|
||||
|
||||
+/* libucontext does not seem to support tlsbase, undef the macro
|
||||
+ * here to make sure we define initcontext and fixcontext as dummies. */
|
||||
+#undef SETCONTEXT_CLOBBERS_TLS
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5
|
||||
+$as_echo_n "checking for library containing makecontext... " >&6; }
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
#ifndef SETCONTEXT_CLOBBERS_TLS
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char makecontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return makecontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_makecontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_makecontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5
|
||||
+$as_echo "$ac_cv_search_makecontext" >&6; }
|
||||
+ac_res=$ac_cv_search_makecontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5
|
||||
$as_echo_n "checking for library containing sched_yield... " >&6; }
|
||||
if ${ac_cv_search_sched_yield+:} false; then :
|
||||
diff --git a/libgo/configure.ac b/libgo/configure.ac
|
||||
index 09554a37..a59aa091 100644
|
||||
--- a/libgo/configure.ac
|
||||
+++ b/libgo/configure.ac
|
||||
@@ -570,6 +570,9 @@ PTHREAD_LIBS=
|
||||
AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
|
||||
static inline void
|
||||
+dnl Test if -lucontext is required for makecontext.
|
||||
+AC_SEARCH_LIBS([makecontext], [ucontext])
|
||||
+
|
||||
dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime.
|
||||
AC_SEARCH_LIBS([sched_yield], [rt])
|
||||
AC_SEARCH_LIBS([nanosleep], [rt])
|
||||
@@ -1,45 +1,204 @@
|
||||
From 5093aa99f9cdded2e1ddf67b7139da6fac36b0a6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Mon, 19 Apr 2021 07:21:41 +0200
|
||||
Subject: [PATCH] Use generic errstr.go implementation on musl
|
||||
From b3840bdcc0eee2a4d099a9af52199944ade7acb9 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Tue, 29 Nov 2022 17:28:44 -0800
|
||||
Subject: [PATCH] syscall, runtime: always call XSI strerror_r
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc provides two version of strerror_r() depending on a feature test
|
||||
macro. The first is the XSI-compliant version which returns an int, the
|
||||
second is GNU-specific and returns a char pointer.
|
||||
This does the right thing for either glibc or musl on GNU/Linux.
|
||||
|
||||
Similarity, gcc's libgo provides two implementations of Errstr() both of
|
||||
which use strerror_r(). On Linux, it is assumed that the GNU-specific
|
||||
strerror_r version is used. However, musl only provides the
|
||||
XSI-compliant version of strerror_r. This patch enables the generic
|
||||
Errstr() implementation which also uses the XSI-compliant version of
|
||||
strerror_r.
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: If2969e131f0fae456d58b35d839d8abe191fcc59
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
||||
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
|
||||
---
|
||||
libgo/go/syscall/errstr.go | 1 -
|
||||
libgo/go/syscall/errstr_glibc.go | 2 +-
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
libgo/Makefile.am | 1 +
|
||||
libgo/Makefile.in | 6 +++++-
|
||||
libgo/go/syscall/errstr.go | 22 ++++++++-----------
|
||||
libgo/go/syscall/errstr_glibc.go | 33 ----------------------------
|
||||
libgo/runtime/go-strerror.c | 37 ++++++++++++++++++++++++++++++++
|
||||
5 files changed, 52 insertions(+), 47 deletions(-)
|
||||
delete mode 100644 libgo/go/syscall/errstr_glibc.go
|
||||
create mode 100644 libgo/runtime/go-strerror.c
|
||||
|
||||
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
|
||||
index e0a1eec5..df568743 100644
|
||||
--- a/libgo/Makefile.am
|
||||
+++ b/libgo/Makefile.am
|
||||
@@ -465,6 +465,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
|
||||
index 7bef5df9..f2f3f0fc 100644
|
||||
--- a/libgo/Makefile.in
|
||||
+++ b/libgo/Makefile.in
|
||||
@@ -247,7 +247,7 @@ am__objects_4 = runtime/aeshash.lo runtime/go-assert.lo \
|
||||
runtime/go-fieldtrack.lo runtime/go-matherr.lo \
|
||||
runtime/go-memclr.lo runtime/go-memmove.lo \
|
||||
runtime/go-memequal.lo runtime/go-nanotime.lo \
|
||||
- runtime/go-now.lo runtime/go-nosys.lo \
|
||||
+ runtime/go-now.lo runtime/go-nosys.lo runtime/go-strerror.lo \
|
||||
runtime/go-reflect-call.lo runtime/go-setenv.lo \
|
||||
runtime/go-signal.lo runtime/go-unsafe-pointer.lo \
|
||||
runtime/go-unsetenv.lo runtime/go-unwind.lo \
|
||||
@@ -917,6 +917,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
@@ -1390,6 +1391,8 @@ runtime/go-now.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-nosys.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
+runtime/go-strerror.lo: runtime/$(am__dirstamp) \
|
||||
+ runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-reflect-call.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-setenv.lo: runtime/$(am__dirstamp) \
|
||||
@@ -1457,6 +1460,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-reflect-call.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-setenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-signal.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsetenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unwind.Plo@am__quote@
|
||||
diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go
|
||||
index 6c2441d364d..8f7c5538163 100644
|
||||
index 6c2441d3..9f688e2a 100644
|
||||
--- a/libgo/go/syscall/errstr.go
|
||||
+++ b/libgo/go/syscall/errstr.go
|
||||
@@ -5,7 +5,6 @@
|
||||
@@ -4,23 +4,19 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !hurd
|
||||
-// +build !hurd
|
||||
-// +build !linux
|
||||
|
||||
-
|
||||
package syscall
|
||||
|
||||
-//sysnb strerror_r(errnum int, buf []byte) (err Errno)
|
||||
-//strerror_r(errnum _C_int, buf *byte, buflen Size_t) _C_int
|
||||
+import "internal/bytealg"
|
||||
+
|
||||
+//extern go_strerror
|
||||
+func go_strerror(_C_int, *byte, Size_t) _C_int
|
||||
|
||||
func Errstr(errnum int) string {
|
||||
- for len := 128; ; len *= 2 {
|
||||
- b := make([]byte, len)
|
||||
- errno := strerror_r(errnum, b)
|
||||
+ for size := 128; ; size *= 2 {
|
||||
+ b := make([]byte, size)
|
||||
+ errno := go_strerror(_C_int(errnum), &b[0], Size_t(len(b)))
|
||||
if errno == 0 {
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
+ i := bytealg.IndexByte(b, 0)
|
||||
// Lowercase first letter: Bad -> bad, but
|
||||
// STREAM -> STREAM.
|
||||
if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
@@ -29,7 +25,7 @@ func Errstr(errnum int) string {
|
||||
return string(b[:i])
|
||||
}
|
||||
if errno != ERANGE {
|
||||
- return "errstr failure"
|
||||
+ return "strerror_r failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/libgo/go/syscall/errstr_glibc.go b/libgo/go/syscall/errstr_glibc.go
|
||||
index 5b19e6f202d..8dc60172186 100644
|
||||
deleted file mode 100644
|
||||
index 5b19e6f2..00000000
|
||||
--- a/libgo/go/syscall/errstr_glibc.go
|
||||
+++ b/libgo/go/syscall/errstr_glibc.go
|
||||
@@ -7,7 +7,7 @@
|
||||
// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
// returns a pointer to the error message, and may not use buf at all.
|
||||
|
||||
+++ /dev/null
|
||||
@@ -1,33 +0,0 @@
|
||||
-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
|
||||
-
|
||||
-// Copyright 2010 The Go Authors. All rights reserved.
|
||||
-// Use of this source code is governed by a BSD-style
|
||||
-// license that can be found in the LICENSE file.
|
||||
-
|
||||
-// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
-// returns a pointer to the error message, and may not use buf at all.
|
||||
-
|
||||
-// +build hurd linux
|
||||
+// +build hurd !linux
|
||||
|
||||
package syscall
|
||||
|
||||
-
|
||||
-package syscall
|
||||
-
|
||||
-import "unsafe"
|
||||
-
|
||||
-//sysnb strerror_r(errnum int, b []byte) (errstr *byte)
|
||||
-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
|
||||
-
|
||||
-func Errstr(errnum int) string {
|
||||
- a := make([]byte, 128)
|
||||
- p := strerror_r(errnum, a)
|
||||
- b := (*[1000]byte)(unsafe.Pointer(p))
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
- // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||
- if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
- c := b[0] + 'a' - 'A'
|
||||
- return string(c) + string(b[1:i])
|
||||
- }
|
||||
- return string(b[:i])
|
||||
-}
|
||||
diff --git a/libgo/runtime/go-strerror.c b/libgo/runtime/go-strerror.c
|
||||
new file mode 100644
|
||||
index 00000000..13d1d91d
|
||||
--- /dev/null
|
||||
+++ b/libgo/runtime/go-strerror.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* go-strerror.c -- wrapper around XSI-compliant strerror_r.
|
||||
+
|
||||
+ Copyright 2022 The Go Authors. All rights reserved.
|
||||
+ Use of this source code is governed by a BSD-style
|
||||
+ license that can be found in the LICENSE file. */
|
||||
+
|
||||
+/* There are two version of strerror_r on GNU/Linux: a GNU-specific
|
||||
+ and an XSI-compliant version. The former version is only available
|
||||
+ on glibc. Since glibc 2.13, the XSI-compliant version is also
|
||||
+ provided by glibc if _GNU_SOURCE is not defined. Since the
|
||||
+ entirety of gofrontend is compiled with _GNU_SOURCE, this file
|
||||
+ exists to selectively undefine it and provides an alias to the
|
||||
+ XSI-compliant version of strerror_r(3). */
|
||||
+
|
||||
+#ifdef __linux__
|
||||
+
|
||||
+/* Force selection of XSI-compliant strerror_r by glibc. */
|
||||
+#undef XOPEN_SOURCE
|
||||
+#define XOPEN_SOURCE 600
|
||||
+#undef _POSIX_C_SOURCE
|
||||
+#define _POSIX_C_SOURCE 200112L
|
||||
+#undef _GNU_SOURCE
|
||||
+
|
||||
+#endif /* __linux__ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#ifndef HAVE_STRERROR_R
|
||||
+// Provided by go-nosys.c if not provided by libc itself.
|
||||
+extern int strerror_r (int, char *, size_t);
|
||||
+#endif
|
||||
+
|
||||
+int
|
||||
+go_strerror (int errnum, char *buf, size_t buflen)
|
||||
+{
|
||||
+ return strerror_r (errnum, buf, buflen);
|
||||
+}
|
||||
@@ -1,22 +1,26 @@
|
||||
From 4b6240d5301ce04b8bbc3e2152915cbc7da80584 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Wed, 28 Sep 2022 17:30:14 +0200
|
||||
Subject: [PATCH] libgo: use _off_t for mmap offset argument
|
||||
From 5e658f4659c551330ea68f5667e4f951b218f32d Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Wed, 26 Oct 2022 17:23:42 -0700
|
||||
Subject: [PATCH] runtime: use _libgo_off_t_type when calling C mmap
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
On glibc-based systems, off_t is a 32-bit type on 32-bit systems and a
|
||||
64-bit type on 64-bit systems by default. However, on systems using musl
|
||||
libc off_t is unconditionally a 64-bit type. As such, it is insufficient
|
||||
to use a uintptr type for the mmap offset parameter.
|
||||
The last argument to the C mmap function is type off_t, not uintptr.
|
||||
On some 32-bit systems, off_t is larger than uintptr.
|
||||
|
||||
Presently, the (incorrect) mmap declaration causes a libgo run-time
|
||||
failure on 32-bit musl systems (fatal error: runtime: cannot allocate
|
||||
memory). This commit fixes this run-time error.
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: Ib6f9d5bcd4734f99a72889e2282b97ec3c8fbd34
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/445735
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
libgo/go/runtime/mem_gccgo.go | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
libgo/go/runtime/mem_gccgo.go | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go
|
||||
index fa3389d8..07bf325a 100644
|
||||
index fa3389d8..1e84f4f5 100644
|
||||
--- a/libgo/go/runtime/mem_gccgo.go
|
||||
+++ b/libgo/go/runtime/mem_gccgo.go
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
@@ -24,7 +28,7 @@ index fa3389d8..07bf325a 100644
|
||||
|
||||
//extern mmap
|
||||
-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
|
||||
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _off_t) unsafe.Pointer
|
||||
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _libgo_off_t_type) unsafe.Pointer
|
||||
|
||||
//extern munmap
|
||||
func munmap(addr unsafe.Pointer, length uintptr) int32
|
||||
@@ -33,7 +37,23 @@ index fa3389d8..07bf325a 100644
|
||||
|
||||
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
|
||||
- p := sysMmap(addr, n, prot, flags, fd, off)
|
||||
+ p := sysMmap(addr, n, prot, flags, fd, _off_t(off))
|
||||
+ p := sysMmap(addr, n, prot, flags, fd, _libgo_off_t_type(off))
|
||||
if uintptr(p) == _MAP_FAILED {
|
||||
return nil, errno()
|
||||
}
|
||||
@@ -47,6 +47,7 @@ func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (u
|
||||
|
||||
// Don't split the stack as this method may be invoked without a valid G, which
|
||||
// prevents us from allocating more stack.
|
||||
+//
|
||||
//go:nosplit
|
||||
func sysAlloc(n uintptr, sysStat *sysMemStat) unsafe.Pointer {
|
||||
p, err := mmap(nil, n, _PROT_READ|_PROT_WRITE, _MAP_ANON|_MAP_PRIVATE, mmapFD, 0)
|
||||
@@ -165,6 +166,7 @@ func sysHugePage(v unsafe.Pointer, n uintptr) {
|
||||
|
||||
// Don't split the stack as this function may be invoked without a valid G,
|
||||
// which prevents us from allocating more stack.
|
||||
+//
|
||||
//go:nosplit
|
||||
func sysFree(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
|
||||
sysStat.add(-int64(n))
|
||||
@@ -0,0 +1,65 @@
|
||||
From 7b8400f902ef25ea71ed460716c1afedca357a61 Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Wed, 2 Nov 2022 12:31:36 +0100
|
||||
Subject: [PATCH] libphobos: fix undefined reference to `__cmsg_nxthdr' with
|
||||
musl
|
||||
|
||||
Ported fix from upstream.
|
||||
|
||||
Upstream: https://github.com/dlang/dmd/commit/54544260a848c8ebad5582e27ac1e09627cdfb17
|
||||
Bug-URL: https://issues.dlang.org/show_bug.cgi?id=23157
|
||||
---
|
||||
.../libdruntime/core/sys/posix/sys/socket.d | 36 +++++++++++++++++--
|
||||
1 file changed, 33 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
index c1309a68c9c..e3b536d87e7 100644
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
@@ -188,10 +188,40 @@ version (linux)
|
||||
|
||||
extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
|
||||
|
||||
- private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
|
||||
- extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ version (CRuntime_Musl)
|
||||
{
|
||||
- return __cmsg_nxthdr(msg, cmsg);
|
||||
+ extern (D)
|
||||
+ {
|
||||
+ private size_t __CMSG_LEN(inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return (cmsg.cmsg_len + size_t.sizeof -1) & cast(size_t)(~(size_t.sizeof - 1));
|
||||
+ }
|
||||
+
|
||||
+ private inout(cmsghdr)* __CMSG_NEXT(inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cmsg + __CMSG_LEN(cmsg);
|
||||
+ }
|
||||
+
|
||||
+ private inout(msghdr)* __MHDR_END(inout(msghdr)* mhdr) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cast(inout(msghdr)*)(mhdr.msg_control + mhdr.msg_controllen);
|
||||
+ }
|
||||
+
|
||||
+ inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cmsg.cmsg_len < cmsghdr.sizeof ||
|
||||
+ __CMSG_LEN(cmsg) + cmsghdr.sizeof >= __MHDR_END(msg) - cast(inout(msghdr)*)(cmsg)
|
||||
+ ? cast(inout(cmsghdr)*) null : cast(inout(cmsghdr)*) __CMSG_NEXT(cmsg);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
|
||||
+ extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return __cmsg_nxthdr(msg, cmsg);
|
||||
+ }
|
||||
}
|
||||
|
||||
extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
|
||||
--
|
||||
2.38.1
|
||||
|
||||
+18
-19
@@ -10,7 +10,7 @@ LANG_JAVA=false
|
||||
LANG_GO=false
|
||||
LANG_FORTRAN=false
|
||||
LANG_ADA=false
|
||||
options="!strip !tracedeps"
|
||||
options="!strip"
|
||||
|
||||
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
|
||||
# when this variable matches "no*"
|
||||
@@ -26,13 +26,13 @@ _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
|
||||
pkgname=gcc-armhf
|
||||
_pkgbase=12.2.1 # must match gcc/BASE-VER
|
||||
_pkgsnap=20220924
|
||||
pkgver=${_pkgbase}_git${_pkgsnap}
|
||||
pkgver=${_pkgbase}_git$_pkgsnap
|
||||
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
|
||||
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
|
||||
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
|
||||
|
||||
pkgname=gcc-armhf
|
||||
pkgrel=2
|
||||
pkgrel=8
|
||||
pkgdesc="Stage2 cross-compiler for armhf"
|
||||
url="https://gcc.gnu.org"
|
||||
arch="x86_64"
|
||||
@@ -212,7 +212,7 @@ makedepends="$makedepends_build $makedepends_host"
|
||||
#
|
||||
# PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches,
|
||||
# so that they can be properly tracked and easily rebased if needed.
|
||||
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-${_pkgbase%%.*}-${_pkgsnap}.tar.xz
|
||||
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz
|
||||
0001-posix_memalign.patch
|
||||
0002-gcc-poison-system-directories.patch
|
||||
0003-specs-turn-on-Wl-z-now-by-default.patch
|
||||
@@ -258,10 +258,11 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-
|
||||
0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
|
||||
0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
|
||||
0053-libgo-make-match.sh-POSIX-shell-compatible.patch
|
||||
0054-libphobos-fix-undefined-reference-to-__cmsg_nxthdr-w.patch
|
||||
"
|
||||
|
||||
# we build out-of-tree
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-${_pkgsnap}
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
|
||||
_gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
|
||||
_gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}"
|
||||
|
||||
@@ -322,10 +323,9 @@ build() {
|
||||
|
||||
case "$CTARGET_LIBC" in
|
||||
musl)
|
||||
# musl does not support mudflap, or libsanitizer
|
||||
# libmpx uses secure_getenv and struct _libc_fpstate not present in musl
|
||||
# musl does not support libsanitizer
|
||||
# alpine musl provides libssp_nonshared.a, so we don't need libssp either
|
||||
_libc_configure="--disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer"
|
||||
_libc_configure="--disable-libssp --disable-libsanitizer"
|
||||
_symvers="--disable-symvers"
|
||||
export libat_cv_have_ifunc=no
|
||||
;;
|
||||
@@ -366,9 +366,9 @@ build() {
|
||||
--prefix=/usr
|
||||
--mandir=/usr/share/man
|
||||
--infodir=/usr/share/info
|
||||
--build=${CBUILD}
|
||||
--host=${CHOST}
|
||||
--target=${CTARGET}
|
||||
--build=$CBUILD
|
||||
--host=$CHOST
|
||||
--target=$CTARGET
|
||||
--enable-checking=release
|
||||
--disable-fixed-point
|
||||
--disable-libstdcxx-pch
|
||||
@@ -379,7 +379,6 @@ build() {
|
||||
--enable-__cxa_atexit
|
||||
--enable-default-pie
|
||||
--enable-default-ssp
|
||||
--enable-cloog-backend
|
||||
--enable-languages=$_languages
|
||||
$_arch_configure
|
||||
$_libc_configure
|
||||
@@ -435,12 +434,11 @@ package() {
|
||||
# strip debug info from some static libs
|
||||
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libgphobos.a -o -name libgdruntime.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
|
||||
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
|
||||
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
|
||||
-a -type f \
|
||||
-exec ${STRIP_FOR_TARGET} -g {} +
|
||||
-exec $STRIP_FOR_TARGET -g {} +
|
||||
|
||||
if $_libgomp; then
|
||||
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
|
||||
@@ -657,7 +655,6 @@ gdc() {
|
||||
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
|
||||
}
|
||||
|
||||
|
||||
libgo() {
|
||||
pkgdesc="Go runtime library for GCC"
|
||||
depends=
|
||||
@@ -667,8 +664,9 @@ libgo() {
|
||||
}
|
||||
|
||||
go() {
|
||||
pkgdesc="Go support for GCC"
|
||||
pkgdesc="GCC Go frontend (intended for bootstrapping community/go)"
|
||||
depends="gcc=$_gccrel libgo=$_gccrel !go"
|
||||
install="$pkgname-go.post-install"
|
||||
|
||||
# See https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E
|
||||
provides="go-bootstrap"
|
||||
@@ -795,12 +793,12 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc
|
||||
674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch
|
||||
f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch
|
||||
5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch
|
||||
3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch
|
||||
699dc3641099da6136dd3689f06c6553c03b3a85acf83a3fce1beb5425065b3e378535ca9e9100a120fdbafc34871d61c063fd5328a49cd87a15a989ed51706d 0034-Use-generic-errstr.go-implementation-on-musl.patch
|
||||
72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch
|
||||
141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch
|
||||
d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
|
||||
ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
|
||||
8bc6823f0b3c66f7b73d7ddb64ffa6930463285c2e9a14a2bc1882bcc4271144eaa1107d713294699caf9481648163cbf43921a2b8e4ac0d55c78a804bae8a3d 0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
|
||||
e9699f4721778869eb3a8fef2c679208ef5b98584892f30b0e1cb5dc1669f8158198d7792659b1b56c381baf62247d21990dcced9178547affd5d6bfb2d12548 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
|
||||
f0744c01859e67deed404c97e1870b2876935fdc467e51980373744936574c314d5d21134734c5d515e7f3cd3483ef98045b9bbcd81c568c6038fac96ffb5fa0 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
|
||||
d6dc1bfb881a313d167aaa5658790b0f55eea4336c408cfc6613dd5783440dafd0d37c43031a5f3e69be40f632e38371cd4fb6e5f0494ac4ea4d7d5025d2ae02 0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
|
||||
684c6a6d52512b973429b6e709966439ac1e174f9e79a33d4a638b452245b457b34752b4b4034ba983f6a712f86522e7adf715bab00a6603f64a12139c5b1e39 0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
|
||||
25014dfa99d96ee70ce0ad22e9f7974f0a51cc50b3b9c2db49df50774c8cd29e497ceed120486bee50be83bfb07f2009ed310eb9b0543f2795bd7359b87eadd2 0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
|
||||
@@ -811,4 +809,5 @@ c33ca2553642c2dbd1c65cd97046548f08775785a3db06d761e3bbe61398c37bc382fe132c0c3fa2
|
||||
c82d7c8d340a76df3d796565a79b0ccc04ddffef39927620e1f3719bf2dc1db101ba13aef24b46c5bc95b7bf1e31c8bda4ab0936ba4c9c5e5047ba08826c982c 0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
|
||||
eb403d8ea665fd5dc2c11faf43b055e6a3bf480a397ceee3e0ca1e38ec7d2392315f2694ed9a34ffbc99e464f2873fbbf91be8646ea4dea5d3636e3ea22fefa0 0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
|
||||
22fb6edf1ed0387e2b93839ffe6e82a7fee420950af90e91199c3488d966702fdeb1a3396d22be0c73a4051525da9349c93d070a0d83b724c83f2b268da6483f 0053-libgo-make-match.sh-POSIX-shell-compatible.patch
|
||||
9b74d0a0e4140b597708a295bcf51b93944782698470e2ba9bc0f0d4a830fc418da9624eccc85f3d65ff6d50b8ebf40cecd34d5b045db9e6c29614e981e93f92 0054-libphobos-fix-undefined-reference-to-__cmsg_nxthdr-w.patch
|
||||
"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat 1>&2 <<EOF
|
||||
*
|
||||
* gcc-go is used in Alpine for bootstrapping Go.
|
||||
* It is currently discouraged to use it for other purposes.
|
||||
*
|
||||
EOF
|
||||
@@ -1,42 +1,101 @@
|
||||
From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Sun, 30 Aug 2020 19:17:42 +0200
|
||||
Subject: [PATCH] gcc-go: support libucontext
|
||||
From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Mon, 19 Dec 2022 10:37:06 -0800
|
||||
Subject: [PATCH] libgo: check for makecontext in -lucontext
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch allows using gcc-go with libucontext. For this purpose,
|
||||
it unconditionally links gcc-go against -lucontext. Furthermore,
|
||||
it undefines SETCONTEXT_CLOBBERS_TLS in proc.c to prevent usage
|
||||
of makecontext/swapcontext feature that are not support by libucontext.
|
||||
Patch from Sören Tempel.
|
||||
|
||||
Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
Makefile.in | 2 +-
|
||||
libgo/runtime/proc.c | 4 ++++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
libgo/configure.ac | 3 +++
|
||||
2 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 593495e1650..c3e5d489bc0 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -52801,7 +52801,7 @@ configure-target-libgo:
|
||||
esac; \
|
||||
module_srcdir=libgo; \
|
||||
rm -f no-such-file || : ; \
|
||||
- CONFIG_SITE=no-such-file $(SHELL) \
|
||||
+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
|
||||
$$s/$$module_srcdir/configure \
|
||||
--srcdir=$${topdir}/$$module_srcdir \
|
||||
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
|
||||
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
|
||||
index 3a30748d329..a987678fa84 100644
|
||||
--- a/libgo/runtime/proc.c
|
||||
+++ b/libgo/runtime/proc.c
|
||||
@@ -66,6 +66,10 @@ static void gscanstack(G*);
|
||||
diff --git a/libgo/configure b/libgo/configure
|
||||
index 460fdad7..a607dbff 100755
|
||||
--- a/libgo/configure
|
||||
+++ b/libgo/configure
|
||||
@@ -14818,6 +14818,63 @@ fi
|
||||
|
||||
__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
|
||||
|
||||
+/* libucontext does not seem to support tlsbase, undef the macro
|
||||
+ * here to make sure we define initcontext and fixcontext as dummies. */
|
||||
+#undef SETCONTEXT_CLOBBERS_TLS
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5
|
||||
+$as_echo_n "checking for library containing makecontext... " >&6; }
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
#ifndef SETCONTEXT_CLOBBERS_TLS
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char makecontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return makecontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_makecontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_makecontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5
|
||||
+$as_echo "$ac_cv_search_makecontext" >&6; }
|
||||
+ac_res=$ac_cv_search_makecontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5
|
||||
$as_echo_n "checking for library containing sched_yield... " >&6; }
|
||||
if ${ac_cv_search_sched_yield+:} false; then :
|
||||
diff --git a/libgo/configure.ac b/libgo/configure.ac
|
||||
index 09554a37..a59aa091 100644
|
||||
--- a/libgo/configure.ac
|
||||
+++ b/libgo/configure.ac
|
||||
@@ -570,6 +570,9 @@ PTHREAD_LIBS=
|
||||
AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
|
||||
static inline void
|
||||
+dnl Test if -lucontext is required for makecontext.
|
||||
+AC_SEARCH_LIBS([makecontext], [ucontext])
|
||||
+
|
||||
dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime.
|
||||
AC_SEARCH_LIBS([sched_yield], [rt])
|
||||
AC_SEARCH_LIBS([nanosleep], [rt])
|
||||
@@ -1,45 +1,204 @@
|
||||
From 5093aa99f9cdded2e1ddf67b7139da6fac36b0a6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Mon, 19 Apr 2021 07:21:41 +0200
|
||||
Subject: [PATCH] Use generic errstr.go implementation on musl
|
||||
From b3840bdcc0eee2a4d099a9af52199944ade7acb9 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Tue, 29 Nov 2022 17:28:44 -0800
|
||||
Subject: [PATCH] syscall, runtime: always call XSI strerror_r
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc provides two version of strerror_r() depending on a feature test
|
||||
macro. The first is the XSI-compliant version which returns an int, the
|
||||
second is GNU-specific and returns a char pointer.
|
||||
This does the right thing for either glibc or musl on GNU/Linux.
|
||||
|
||||
Similarity, gcc's libgo provides two implementations of Errstr() both of
|
||||
which use strerror_r(). On Linux, it is assumed that the GNU-specific
|
||||
strerror_r version is used. However, musl only provides the
|
||||
XSI-compliant version of strerror_r. This patch enables the generic
|
||||
Errstr() implementation which also uses the XSI-compliant version of
|
||||
strerror_r.
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: If2969e131f0fae456d58b35d839d8abe191fcc59
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
||||
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
|
||||
---
|
||||
libgo/go/syscall/errstr.go | 1 -
|
||||
libgo/go/syscall/errstr_glibc.go | 2 +-
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
libgo/Makefile.am | 1 +
|
||||
libgo/Makefile.in | 6 +++++-
|
||||
libgo/go/syscall/errstr.go | 22 ++++++++-----------
|
||||
libgo/go/syscall/errstr_glibc.go | 33 ----------------------------
|
||||
libgo/runtime/go-strerror.c | 37 ++++++++++++++++++++++++++++++++
|
||||
5 files changed, 52 insertions(+), 47 deletions(-)
|
||||
delete mode 100644 libgo/go/syscall/errstr_glibc.go
|
||||
create mode 100644 libgo/runtime/go-strerror.c
|
||||
|
||||
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
|
||||
index e0a1eec5..df568743 100644
|
||||
--- a/libgo/Makefile.am
|
||||
+++ b/libgo/Makefile.am
|
||||
@@ -465,6 +465,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
|
||||
index 7bef5df9..f2f3f0fc 100644
|
||||
--- a/libgo/Makefile.in
|
||||
+++ b/libgo/Makefile.in
|
||||
@@ -247,7 +247,7 @@ am__objects_4 = runtime/aeshash.lo runtime/go-assert.lo \
|
||||
runtime/go-fieldtrack.lo runtime/go-matherr.lo \
|
||||
runtime/go-memclr.lo runtime/go-memmove.lo \
|
||||
runtime/go-memequal.lo runtime/go-nanotime.lo \
|
||||
- runtime/go-now.lo runtime/go-nosys.lo \
|
||||
+ runtime/go-now.lo runtime/go-nosys.lo runtime/go-strerror.lo \
|
||||
runtime/go-reflect-call.lo runtime/go-setenv.lo \
|
||||
runtime/go-signal.lo runtime/go-unsafe-pointer.lo \
|
||||
runtime/go-unsetenv.lo runtime/go-unwind.lo \
|
||||
@@ -917,6 +917,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
@@ -1390,6 +1391,8 @@ runtime/go-now.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-nosys.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
+runtime/go-strerror.lo: runtime/$(am__dirstamp) \
|
||||
+ runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-reflect-call.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-setenv.lo: runtime/$(am__dirstamp) \
|
||||
@@ -1457,6 +1460,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-reflect-call.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-setenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-signal.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsetenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unwind.Plo@am__quote@
|
||||
diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go
|
||||
index 6c2441d364d..8f7c5538163 100644
|
||||
index 6c2441d3..9f688e2a 100644
|
||||
--- a/libgo/go/syscall/errstr.go
|
||||
+++ b/libgo/go/syscall/errstr.go
|
||||
@@ -5,7 +5,6 @@
|
||||
@@ -4,23 +4,19 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !hurd
|
||||
-// +build !hurd
|
||||
-// +build !linux
|
||||
|
||||
-
|
||||
package syscall
|
||||
|
||||
-//sysnb strerror_r(errnum int, buf []byte) (err Errno)
|
||||
-//strerror_r(errnum _C_int, buf *byte, buflen Size_t) _C_int
|
||||
+import "internal/bytealg"
|
||||
+
|
||||
+//extern go_strerror
|
||||
+func go_strerror(_C_int, *byte, Size_t) _C_int
|
||||
|
||||
func Errstr(errnum int) string {
|
||||
- for len := 128; ; len *= 2 {
|
||||
- b := make([]byte, len)
|
||||
- errno := strerror_r(errnum, b)
|
||||
+ for size := 128; ; size *= 2 {
|
||||
+ b := make([]byte, size)
|
||||
+ errno := go_strerror(_C_int(errnum), &b[0], Size_t(len(b)))
|
||||
if errno == 0 {
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
+ i := bytealg.IndexByte(b, 0)
|
||||
// Lowercase first letter: Bad -> bad, but
|
||||
// STREAM -> STREAM.
|
||||
if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
@@ -29,7 +25,7 @@ func Errstr(errnum int) string {
|
||||
return string(b[:i])
|
||||
}
|
||||
if errno != ERANGE {
|
||||
- return "errstr failure"
|
||||
+ return "strerror_r failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/libgo/go/syscall/errstr_glibc.go b/libgo/go/syscall/errstr_glibc.go
|
||||
index 5b19e6f202d..8dc60172186 100644
|
||||
deleted file mode 100644
|
||||
index 5b19e6f2..00000000
|
||||
--- a/libgo/go/syscall/errstr_glibc.go
|
||||
+++ b/libgo/go/syscall/errstr_glibc.go
|
||||
@@ -7,7 +7,7 @@
|
||||
// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
// returns a pointer to the error message, and may not use buf at all.
|
||||
|
||||
+++ /dev/null
|
||||
@@ -1,33 +0,0 @@
|
||||
-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
|
||||
-
|
||||
-// Copyright 2010 The Go Authors. All rights reserved.
|
||||
-// Use of this source code is governed by a BSD-style
|
||||
-// license that can be found in the LICENSE file.
|
||||
-
|
||||
-// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
-// returns a pointer to the error message, and may not use buf at all.
|
||||
-
|
||||
-// +build hurd linux
|
||||
+// +build hurd !linux
|
||||
|
||||
package syscall
|
||||
|
||||
-
|
||||
-package syscall
|
||||
-
|
||||
-import "unsafe"
|
||||
-
|
||||
-//sysnb strerror_r(errnum int, b []byte) (errstr *byte)
|
||||
-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
|
||||
-
|
||||
-func Errstr(errnum int) string {
|
||||
- a := make([]byte, 128)
|
||||
- p := strerror_r(errnum, a)
|
||||
- b := (*[1000]byte)(unsafe.Pointer(p))
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
- // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||
- if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
- c := b[0] + 'a' - 'A'
|
||||
- return string(c) + string(b[1:i])
|
||||
- }
|
||||
- return string(b[:i])
|
||||
-}
|
||||
diff --git a/libgo/runtime/go-strerror.c b/libgo/runtime/go-strerror.c
|
||||
new file mode 100644
|
||||
index 00000000..13d1d91d
|
||||
--- /dev/null
|
||||
+++ b/libgo/runtime/go-strerror.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* go-strerror.c -- wrapper around XSI-compliant strerror_r.
|
||||
+
|
||||
+ Copyright 2022 The Go Authors. All rights reserved.
|
||||
+ Use of this source code is governed by a BSD-style
|
||||
+ license that can be found in the LICENSE file. */
|
||||
+
|
||||
+/* There are two version of strerror_r on GNU/Linux: a GNU-specific
|
||||
+ and an XSI-compliant version. The former version is only available
|
||||
+ on glibc. Since glibc 2.13, the XSI-compliant version is also
|
||||
+ provided by glibc if _GNU_SOURCE is not defined. Since the
|
||||
+ entirety of gofrontend is compiled with _GNU_SOURCE, this file
|
||||
+ exists to selectively undefine it and provides an alias to the
|
||||
+ XSI-compliant version of strerror_r(3). */
|
||||
+
|
||||
+#ifdef __linux__
|
||||
+
|
||||
+/* Force selection of XSI-compliant strerror_r by glibc. */
|
||||
+#undef XOPEN_SOURCE
|
||||
+#define XOPEN_SOURCE 600
|
||||
+#undef _POSIX_C_SOURCE
|
||||
+#define _POSIX_C_SOURCE 200112L
|
||||
+#undef _GNU_SOURCE
|
||||
+
|
||||
+#endif /* __linux__ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#ifndef HAVE_STRERROR_R
|
||||
+// Provided by go-nosys.c if not provided by libc itself.
|
||||
+extern int strerror_r (int, char *, size_t);
|
||||
+#endif
|
||||
+
|
||||
+int
|
||||
+go_strerror (int errnum, char *buf, size_t buflen)
|
||||
+{
|
||||
+ return strerror_r (errnum, buf, buflen);
|
||||
+}
|
||||
@@ -1,22 +1,26 @@
|
||||
From 4b6240d5301ce04b8bbc3e2152915cbc7da80584 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Wed, 28 Sep 2022 17:30:14 +0200
|
||||
Subject: [PATCH] libgo: use _off_t for mmap offset argument
|
||||
From 5e658f4659c551330ea68f5667e4f951b218f32d Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Wed, 26 Oct 2022 17:23:42 -0700
|
||||
Subject: [PATCH] runtime: use _libgo_off_t_type when calling C mmap
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
On glibc-based systems, off_t is a 32-bit type on 32-bit systems and a
|
||||
64-bit type on 64-bit systems by default. However, on systems using musl
|
||||
libc off_t is unconditionally a 64-bit type. As such, it is insufficient
|
||||
to use a uintptr type for the mmap offset parameter.
|
||||
The last argument to the C mmap function is type off_t, not uintptr.
|
||||
On some 32-bit systems, off_t is larger than uintptr.
|
||||
|
||||
Presently, the (incorrect) mmap declaration causes a libgo run-time
|
||||
failure on 32-bit musl systems (fatal error: runtime: cannot allocate
|
||||
memory). This commit fixes this run-time error.
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: Ib6f9d5bcd4734f99a72889e2282b97ec3c8fbd34
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/445735
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
libgo/go/runtime/mem_gccgo.go | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
libgo/go/runtime/mem_gccgo.go | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go
|
||||
index fa3389d8..07bf325a 100644
|
||||
index fa3389d8..1e84f4f5 100644
|
||||
--- a/libgo/go/runtime/mem_gccgo.go
|
||||
+++ b/libgo/go/runtime/mem_gccgo.go
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
@@ -24,7 +28,7 @@ index fa3389d8..07bf325a 100644
|
||||
|
||||
//extern mmap
|
||||
-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
|
||||
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _off_t) unsafe.Pointer
|
||||
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off _libgo_off_t_type) unsafe.Pointer
|
||||
|
||||
//extern munmap
|
||||
func munmap(addr unsafe.Pointer, length uintptr) int32
|
||||
@@ -33,7 +37,23 @@ index fa3389d8..07bf325a 100644
|
||||
|
||||
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
|
||||
- p := sysMmap(addr, n, prot, flags, fd, off)
|
||||
+ p := sysMmap(addr, n, prot, flags, fd, _off_t(off))
|
||||
+ p := sysMmap(addr, n, prot, flags, fd, _libgo_off_t_type(off))
|
||||
if uintptr(p) == _MAP_FAILED {
|
||||
return nil, errno()
|
||||
}
|
||||
@@ -47,6 +47,7 @@ func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (u
|
||||
|
||||
// Don't split the stack as this method may be invoked without a valid G, which
|
||||
// prevents us from allocating more stack.
|
||||
+//
|
||||
//go:nosplit
|
||||
func sysAlloc(n uintptr, sysStat *sysMemStat) unsafe.Pointer {
|
||||
p, err := mmap(nil, n, _PROT_READ|_PROT_WRITE, _MAP_ANON|_MAP_PRIVATE, mmapFD, 0)
|
||||
@@ -165,6 +166,7 @@ func sysHugePage(v unsafe.Pointer, n uintptr) {
|
||||
|
||||
// Don't split the stack as this function may be invoked without a valid G,
|
||||
// which prevents us from allocating more stack.
|
||||
+//
|
||||
//go:nosplit
|
||||
func sysFree(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
|
||||
sysStat.add(-int64(n))
|
||||
@@ -0,0 +1,65 @@
|
||||
From 7b8400f902ef25ea71ed460716c1afedca357a61 Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Wed, 2 Nov 2022 12:31:36 +0100
|
||||
Subject: [PATCH] libphobos: fix undefined reference to `__cmsg_nxthdr' with
|
||||
musl
|
||||
|
||||
Ported fix from upstream.
|
||||
|
||||
Upstream: https://github.com/dlang/dmd/commit/54544260a848c8ebad5582e27ac1e09627cdfb17
|
||||
Bug-URL: https://issues.dlang.org/show_bug.cgi?id=23157
|
||||
---
|
||||
.../libdruntime/core/sys/posix/sys/socket.d | 36 +++++++++++++++++--
|
||||
1 file changed, 33 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
index c1309a68c9c..e3b536d87e7 100644
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
|
||||
@@ -188,10 +188,40 @@ version (linux)
|
||||
|
||||
extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
|
||||
|
||||
- private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
|
||||
- extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ version (CRuntime_Musl)
|
||||
{
|
||||
- return __cmsg_nxthdr(msg, cmsg);
|
||||
+ extern (D)
|
||||
+ {
|
||||
+ private size_t __CMSG_LEN(inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return (cmsg.cmsg_len + size_t.sizeof -1) & cast(size_t)(~(size_t.sizeof - 1));
|
||||
+ }
|
||||
+
|
||||
+ private inout(cmsghdr)* __CMSG_NEXT(inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cmsg + __CMSG_LEN(cmsg);
|
||||
+ }
|
||||
+
|
||||
+ private inout(msghdr)* __MHDR_END(inout(msghdr)* mhdr) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cast(inout(msghdr)*)(mhdr.msg_control + mhdr.msg_controllen);
|
||||
+ }
|
||||
+
|
||||
+ inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return cmsg.cmsg_len < cmsghdr.sizeof ||
|
||||
+ __CMSG_LEN(cmsg) + cmsghdr.sizeof >= __MHDR_END(msg) - cast(inout(msghdr)*)(cmsg)
|
||||
+ ? cast(inout(cmsghdr)*) null : cast(inout(cmsghdr)*) __CMSG_NEXT(cmsg);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
|
||||
+ extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
|
||||
+ {
|
||||
+ return __cmsg_nxthdr(msg, cmsg);
|
||||
+ }
|
||||
}
|
||||
|
||||
extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
|
||||
--
|
||||
2.38.1
|
||||
|
||||
+18
-19
@@ -10,7 +10,7 @@ LANG_JAVA=false
|
||||
LANG_GO=false
|
||||
LANG_FORTRAN=false
|
||||
LANG_ADA=false
|
||||
options="!strip !tracedeps"
|
||||
options="!strip"
|
||||
|
||||
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
|
||||
# when this variable matches "no*"
|
||||
@@ -26,13 +26,13 @@ _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
|
||||
pkgname=gcc-armv7
|
||||
_pkgbase=12.2.1 # must match gcc/BASE-VER
|
||||
_pkgsnap=20220924
|
||||
pkgver=${_pkgbase}_git${_pkgsnap}
|
||||
pkgver=${_pkgbase}_git$_pkgsnap
|
||||
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
|
||||
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
|
||||
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
|
||||
|
||||
pkgname=gcc-armv7
|
||||
pkgrel=2
|
||||
pkgrel=8
|
||||
pkgdesc="Stage2 cross-compiler for armv7"
|
||||
url="https://gcc.gnu.org"
|
||||
arch="x86_64"
|
||||
@@ -212,7 +212,7 @@ makedepends="$makedepends_build $makedepends_host"
|
||||
#
|
||||
# PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches,
|
||||
# so that they can be properly tracked and easily rebased if needed.
|
||||
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-${_pkgbase%%.*}-${_pkgsnap}.tar.xz
|
||||
source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz
|
||||
0001-posix_memalign.patch
|
||||
0002-gcc-poison-system-directories.patch
|
||||
0003-specs-turn-on-Wl-z-now-by-default.patch
|
||||
@@ -258,10 +258,11 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-${_pkgsnap}/gcc-
|
||||
0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
|
||||
0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
|
||||
0053-libgo-make-match.sh-POSIX-shell-compatible.patch
|
||||
0054-libphobos-fix-undefined-reference-to-__cmsg_nxthdr-w.patch
|
||||
"
|
||||
|
||||
# we build out-of-tree
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-${_pkgsnap}
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
|
||||
_gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
|
||||
_gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}"
|
||||
|
||||
@@ -322,10 +323,9 @@ build() {
|
||||
|
||||
case "$CTARGET_LIBC" in
|
||||
musl)
|
||||
# musl does not support mudflap, or libsanitizer
|
||||
# libmpx uses secure_getenv and struct _libc_fpstate not present in musl
|
||||
# musl does not support libsanitizer
|
||||
# alpine musl provides libssp_nonshared.a, so we don't need libssp either
|
||||
_libc_configure="--disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer"
|
||||
_libc_configure="--disable-libssp --disable-libsanitizer"
|
||||
_symvers="--disable-symvers"
|
||||
export libat_cv_have_ifunc=no
|
||||
;;
|
||||
@@ -366,9 +366,9 @@ build() {
|
||||
--prefix=/usr
|
||||
--mandir=/usr/share/man
|
||||
--infodir=/usr/share/info
|
||||
--build=${CBUILD}
|
||||
--host=${CHOST}
|
||||
--target=${CTARGET}
|
||||
--build=$CBUILD
|
||||
--host=$CHOST
|
||||
--target=$CTARGET
|
||||
--enable-checking=release
|
||||
--disable-fixed-point
|
||||
--disable-libstdcxx-pch
|
||||
@@ -379,7 +379,6 @@ build() {
|
||||
--enable-__cxa_atexit
|
||||
--enable-default-pie
|
||||
--enable-default-ssp
|
||||
--enable-cloog-backend
|
||||
--enable-languages=$_languages
|
||||
$_arch_configure
|
||||
$_libc_configure
|
||||
@@ -435,12 +434,11 @@ package() {
|
||||
# strip debug info from some static libs
|
||||
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libgphobos.a -o -name libgdruntime.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
|
||||
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
|
||||
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
|
||||
-a -type f \
|
||||
-exec ${STRIP_FOR_TARGET} -g {} +
|
||||
-exec $STRIP_FOR_TARGET -g {} +
|
||||
|
||||
if $_libgomp; then
|
||||
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
|
||||
@@ -657,7 +655,6 @@ gdc() {
|
||||
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
|
||||
}
|
||||
|
||||
|
||||
libgo() {
|
||||
pkgdesc="Go runtime library for GCC"
|
||||
depends=
|
||||
@@ -667,8 +664,9 @@ libgo() {
|
||||
}
|
||||
|
||||
go() {
|
||||
pkgdesc="Go support for GCC"
|
||||
pkgdesc="GCC Go frontend (intended for bootstrapping community/go)"
|
||||
depends="gcc=$_gccrel libgo=$_gccrel !go"
|
||||
install="$pkgname-go.post-install"
|
||||
|
||||
# See https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E
|
||||
provides="go-bootstrap"
|
||||
@@ -795,12 +793,12 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc
|
||||
674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch
|
||||
f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch
|
||||
5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch
|
||||
3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch
|
||||
699dc3641099da6136dd3689f06c6553c03b3a85acf83a3fce1beb5425065b3e378535ca9e9100a120fdbafc34871d61c063fd5328a49cd87a15a989ed51706d 0034-Use-generic-errstr.go-implementation-on-musl.patch
|
||||
72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch
|
||||
141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch
|
||||
d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
|
||||
ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch
|
||||
8bc6823f0b3c66f7b73d7ddb64ffa6930463285c2e9a14a2bc1882bcc4271144eaa1107d713294699caf9481648163cbf43921a2b8e4ac0d55c78a804bae8a3d 0037-libgo-Recognize-off64_t-and-loff_t-definitions-of-mu.patch
|
||||
e9699f4721778869eb3a8fef2c679208ef5b98584892f30b0e1cb5dc1669f8158198d7792659b1b56c381baf62247d21990dcced9178547affd5d6bfb2d12548 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
|
||||
f0744c01859e67deed404c97e1870b2876935fdc467e51980373744936574c314d5d21134734c5d515e7f3cd3483ef98045b9bbcd81c568c6038fac96ffb5fa0 0039-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
|
||||
d6dc1bfb881a313d167aaa5658790b0f55eea4336c408cfc6613dd5783440dafd0d37c43031a5f3e69be40f632e38371cd4fb6e5f0494ac4ea4d7d5025d2ae02 0041-go-gospec-forcibly-disable-fsplit-stack-support.patch
|
||||
684c6a6d52512b973429b6e709966439ac1e174f9e79a33d4a638b452245b457b34752b4b4034ba983f6a712f86522e7adf715bab00a6603f64a12139c5b1e39 0042-gcc-go-fix-build-error-with-SYS_SECCOMP.patch
|
||||
25014dfa99d96ee70ce0ad22e9f7974f0a51cc50b3b9c2db49df50774c8cd29e497ceed120486bee50be83bfb07f2009ed310eb9b0543f2795bd7359b87eadd2 0043-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
|
||||
@@ -811,4 +809,5 @@ c33ca2553642c2dbd1c65cd97046548f08775785a3db06d761e3bbe61398c37bc382fe132c0c3fa2
|
||||
c82d7c8d340a76df3d796565a79b0ccc04ddffef39927620e1f3719bf2dc1db101ba13aef24b46c5bc95b7bf1e31c8bda4ab0936ba4c9c5e5047ba08826c982c 0051-libgo-Explicitly-define-SYS_timer_settime-for-32-bit.patch
|
||||
eb403d8ea665fd5dc2c11faf43b055e6a3bf480a397ceee3e0ca1e38ec7d2392315f2694ed9a34ffbc99e464f2873fbbf91be8646ea4dea5d3636e3ea22fefa0 0052-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
|
||||
22fb6edf1ed0387e2b93839ffe6e82a7fee420950af90e91199c3488d966702fdeb1a3396d22be0c73a4051525da9349c93d070a0d83b724c83f2b268da6483f 0053-libgo-make-match.sh-POSIX-shell-compatible.patch
|
||||
9b74d0a0e4140b597708a295bcf51b93944782698470e2ba9bc0f0d4a830fc418da9624eccc85f3d65ff6d50b8ebf40cecd34d5b045db9e6c29614e981e93f92 0054-libphobos-fix-undefined-reference-to-__cmsg_nxthdr-w.patch
|
||||
"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat 1>&2 <<EOF
|
||||
*
|
||||
* gcc-go is used in Alpine for bootstrapping Go.
|
||||
* It is currently discouraged to use it for other purposes.
|
||||
*
|
||||
EOF
|
||||
@@ -0,0 +1,39 @@
|
||||
From 74c7b0df9971b6bc75d7d172c2819ffd21d51050 Mon Sep 17 00:00:00 2001
|
||||
From: Szabolcs Nagy <nsz@port70.net>
|
||||
Date: Fri, 26 Jan 2018 20:32:50 +0000
|
||||
Subject: [PATCH] posix_memalign
|
||||
|
||||
---
|
||||
gcc/config/i386/pmm_malloc.h | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
|
||||
index 3b2e4f47915..20f790904a2 100644
|
||||
--- a/gcc/config/i386/pmm_malloc.h
|
||||
+++ b/gcc/config/i386/pmm_malloc.h
|
||||
@@ -27,12 +27,13 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
|
||||
- may not be visible. */
|
||||
+ may not be visible and we can't pollute the namespace either. */
|
||||
#ifndef __cplusplus
|
||||
-extern int posix_memalign (void **, size_t, size_t);
|
||||
+extern int _mm_posix_memalign (void **, size_t, size_t)
|
||||
#else
|
||||
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
|
||||
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
|
||||
#endif
|
||||
+__asm__("posix_memalign");
|
||||
|
||||
static __inline void *
|
||||
_mm_malloc (size_t __size, size_t __alignment)
|
||||
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
|
||||
return malloc (__size);
|
||||
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
|
||||
__alignment = sizeof (void *);
|
||||
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
|
||||
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
|
||||
return __ptr;
|
||||
else
|
||||
return NULL;
|
||||
@@ -0,0 +1,200 @@
|
||||
From dd1e75ff4ecda96957465b34681f245e818928bd Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 29 Mar 2013 08:59:00 +0400
|
||||
Subject: [PATCH] gcc: poison-system-directories
|
||||
|
||||
Add /sw/include and /opt/include based on the original
|
||||
zecke-no-host-includes.patch patch. The original patch checked for
|
||||
/usr/include, /sw/include and /opt/include and then triggered a failure and
|
||||
aborted.
|
||||
|
||||
Instead, we add the two missing items to the current scan. If the user
|
||||
wants this to be a failure, they can add "-Werror=poison-system-directories".
|
||||
|
||||
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
Upstream-Status: Pending
|
||||
---
|
||||
gcc/common.opt | 4 ++++
|
||||
gcc/config.in | 6 ++++++
|
||||
gcc/configure | 16 ++++++++++++++++
|
||||
gcc/configure.ac | 10 ++++++++++
|
||||
gcc/doc/invoke.texi | 9 +++++++++
|
||||
gcc/gcc.cc | 2 ++
|
||||
gcc/incpath.cc | 21 +++++++++++++++++++++
|
||||
7 files changed, 68 insertions(+)
|
||||
|
||||
diff --git a/gcc/common.opt b/gcc/common.opt
|
||||
index 8a0dafc522d..0357868e22c 100644
|
||||
--- a/gcc/common.opt
|
||||
+++ b/gcc/common.opt
|
||||
@@ -710,6 +710,10 @@ Wreturn-local-addr
|
||||
Common Var(warn_return_local_addr) Init(1) Warning
|
||||
Warn about returning a pointer/reference to a local or temporary variable.
|
||||
|
||||
+Wpoison-system-directories
|
||||
+Common Var(flag_poison_system_directories) Init(1) Warning
|
||||
+Warn for -I and -L options using system directories if cross compiling
|
||||
+
|
||||
Wshadow
|
||||
Common Var(warn_shadow) Warning
|
||||
Warn when one variable shadows another. Same as -Wshadow=global.
|
||||
diff --git a/gcc/config.in b/gcc/config.in
|
||||
index 64c27c9cfac..f0fbf123aa8 100644
|
||||
--- a/gcc/config.in
|
||||
+++ b/gcc/config.in
|
||||
@@ -230,6 +230,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
+/* Define to warn for use of native system header directories */
|
||||
+#ifndef USED_FOR_TARGET
|
||||
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/* Define if you want all operations on RTL (the basic data structure of the
|
||||
optimizer and back end) to be checked for dynamic type safety at runtime.
|
||||
This is quite expensive. */
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index 5ce0557719a..e9060112384 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -1023,6 +1023,7 @@ enable_maintainer_mode
|
||||
enable_link_mutex
|
||||
enable_link_serialization
|
||||
enable_version_specific_runtime_libs
|
||||
+enable_poison_system_directories
|
||||
enable_plugin
|
||||
enable_host_shared
|
||||
enable_libquadmath_support
|
||||
@@ -1785,6 +1786,8 @@ Optional Features:
|
||||
--enable-version-specific-runtime-libs
|
||||
specify that runtime libraries should be installed
|
||||
in a compiler-specific directory
|
||||
+ --enable-poison-system-directories
|
||||
+ warn for use of native system header directories
|
||||
--enable-plugin enable plugin support
|
||||
--enable-host-shared build host code as shared libraries
|
||||
--disable-libquadmath-support
|
||||
@@ -31982,6 +31985,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
+# Check whether --enable-poison-system-directories was given.
|
||||
+if test "${enable_poison_system_directories+set}" = set; then :
|
||||
+ enableval=$enable_poison_system_directories;
|
||||
+else
|
||||
+ enable_poison_system_directories=no
|
||||
+fi
|
||||
+
|
||||
+if test "x${enable_poison_system_directories}" = "xyes"; then
|
||||
+
|
||||
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
|
||||
+
|
||||
+fi
|
||||
+
|
||||
# Substitute configuration variables
|
||||
|
||||
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index 23bee7010a3..75a7048045c 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -7421,6 +7421,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
|
||||
[specify that runtime libraries should be
|
||||
installed in a compiler-specific directory])])
|
||||
|
||||
+AC_ARG_ENABLE([poison-system-directories],
|
||||
+ AS_HELP_STRING([--enable-poison-system-directories],
|
||||
+ [warn for use of native system header directories]),,
|
||||
+ [enable_poison_system_directories=no])
|
||||
+if test "x${enable_poison_system_directories}" = "xyes"; then
|
||||
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
|
||||
+ [1],
|
||||
+ [Define to warn for use of native system header directories])
|
||||
+fi
|
||||
+
|
||||
# Substitute configuration variables
|
||||
AC_SUBST(subdirs)
|
||||
AC_SUBST(srcdir)
|
||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
||||
index 07b440190c3..b2de464798a 100644
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
|
||||
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
|
||||
-Wparentheses -Wno-pedantic-ms-format @gol
|
||||
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
|
||||
+-Wno-poison-system-directories @gol
|
||||
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
|
||||
-Wrestrict -Wno-return-local-addr -Wreturn-type @gol
|
||||
-Wno-scalar-storage-order -Wsequence-point @gol
|
||||
@@ -8029,6 +8030,14 @@ made up of data only and thus requires no special treatment. But, for
|
||||
most targets, it is made up of code and thus requires the stack to be
|
||||
made executable in order for the program to work properly.
|
||||
|
||||
+@item -Wno-poison-system-directories
|
||||
+@opindex Wno-poison-system-directories
|
||||
+Do not warn for @option{-I} or @option{-L} options using system
|
||||
+directories such as @file{/usr/include} when cross compiling. This
|
||||
+option is intended for use in chroot environments when such
|
||||
+directories contain the correct headers and libraries for the target
|
||||
+system rather than the host.
|
||||
+
|
||||
@item -Wfloat-equal
|
||||
@opindex Wfloat-equal
|
||||
@opindex Wno-float-equal
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index bb07cc244e3..47fb5802194 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -1159,6 +1159,8 @@ proper position among the other output files. */
|
||||
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
|
||||
"%X %{o*} %{e*} %{N} %{n} %{r}\
|
||||
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
|
||||
+ %{Wno-poison-system-directories:--no-poison-system-directories} \
|
||||
+ %{Werror=poison-system-directories:--error-poison-system-directories} \
|
||||
%{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
|
||||
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
|
||||
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
|
||||
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
|
||||
index bd2a97938eb..c80f100f476 100644
|
||||
--- a/gcc/incpath.cc
|
||||
+++ b/gcc/incpath.cc
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "intl.h"
|
||||
#include "incpath.h"
|
||||
#include "cppdefault.h"
|
||||
+#include "diagnostic-core.h"
|
||||
|
||||
/* Microsoft Windows does not natively support inodes.
|
||||
VMS has non-numeric inodes. */
|
||||
@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
|
||||
}
|
||||
fprintf (stderr, _("End of search list.\n"));
|
||||
}
|
||||
+
|
||||
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
|
||||
+ if (flag_poison_system_directories)
|
||||
+ {
|
||||
+ struct cpp_dir *p;
|
||||
+
|
||||
+ for (p = heads[INC_QUOTE]; p; p = p->next)
|
||||
+ {
|
||||
+ if ((!strncmp (p->name, "/usr/include", 12))
|
||||
+ || (!strncmp (p->name, "/usr/local/include", 18))
|
||||
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
|
||||
+ || (!strncmp (p->name, "/sw/include", 11))
|
||||
+ || (!strncmp (p->name, "/opt/include", 12)))
|
||||
+ warning (OPT_Wpoison_system_directories,
|
||||
+ "include location \"%s\" is unsafe for "
|
||||
+ "cross-compilation",
|
||||
+ p->name);
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Use given -I paths for #include "..." but not #include <...>, and
|
||||
@@ -0,0 +1,41 @@
|
||||
From 40e45739e7d3787acd13b5b9a4c27d843de0ffe2 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:45:49 +0000
|
||||
Subject: [PATCH] specs: turn on -Wl,-z,now by default
|
||||
|
||||
Previously, we also used to turn on -z relro here, but we now build
|
||||
binutils with --enable-relro, which is functionally equivalent.
|
||||
|
||||
Binutils does not appear to have a similar option for enabling -z
|
||||
now by default.
|
||||
---
|
||||
gcc/doc/invoke.texi | 3 +++
|
||||
gcc/gcc.cc | 1 +
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
||||
index b2de464798a..83bd1bde433 100644
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -16872,6 +16872,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
|
||||
linker. When using the GNU linker, you can also get the same effect with
|
||||
@option{-Wl,-Map=output.map}.
|
||||
|
||||
+NOTE: In Alpine Linux, for LDFLAGS, the option
|
||||
+@option{-Wl,-z,now} is used. To disable, use @option{-Wl,-z,nonow}.
|
||||
+
|
||||
@item -u @var{symbol}
|
||||
@opindex u
|
||||
Pretend the symbol @var{symbol} is undefined, to force linking of
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 47fb5802194..d18b5d7b59a 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -1157,6 +1157,7 @@ proper position among the other output files. */
|
||||
"%{flto|flto=*:%<fcompare-debug*} \
|
||||
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
|
||||
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
|
||||
+ "-z now " \
|
||||
"%X %{o*} %{e*} %{N} %{n} %{r}\
|
||||
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
|
||||
%{Wno-poison-system-directories:--no-poison-system-directories} \
|
||||
@@ -0,0 +1,43 @@
|
||||
From 666d0aeb808ac9c10d065ae7b196695c81a25a20 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:46:22 +0000
|
||||
Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC,
|
||||
ObjC++, if the optimization level is > 0
|
||||
|
||||
---
|
||||
gcc/c-family/c-cppbuiltin.cc | 4 ++++
|
||||
gcc/doc/invoke.texi | 6 ++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
|
||||
index 4672ae8486a..573c021e1e8 100644
|
||||
--- a/gcc/c-family/c-cppbuiltin.cc
|
||||
+++ b/gcc/c-family/c-cppbuiltin.cc
|
||||
@@ -1510,6 +1510,10 @@ c_cpp_builtins (cpp_reader *pfile)
|
||||
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
|
||||
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
|
||||
|
||||
+ /* Fortify Source enabled by default for optimization levels > 0 */
|
||||
+ if (optimize)
|
||||
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
|
||||
+
|
||||
/* Misc. */
|
||||
if (flag_gnu89_inline)
|
||||
cpp_define (pfile, "__GNUC_GNU_INLINE__");
|
||||
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
|
||||
index 83bd1bde433..dda299a9987 100644
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -10896,6 +10896,12 @@ also turns on the following optimization flags:
|
||||
Please note the warning under @option{-fgcse} about
|
||||
invoking @option{-O2} on programs that use computed gotos.
|
||||
|
||||
+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
|
||||
+set by default, and is activated when @option{-O} is set to 2 or higher.
|
||||
+This enables additional compile-time and run-time checks for several libc
|
||||
+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or
|
||||
+@option{-D_FORTIFY_SOURCE=0}.
|
||||
+
|
||||
@item -O3
|
||||
@opindex O3
|
||||
Optimize yet more. @option{-O3} turns on all optimizations specified
|
||||
@@ -0,0 +1,269 @@
|
||||
From 75d1a35180cf0967f062765314bf091a64032062 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:46:56 +0000
|
||||
Subject: [PATCH] On linux targets pass --as-needed by default to the linker,
|
||||
but always link the sanitizer libraries with --no-as-needed.
|
||||
|
||||
---
|
||||
gcc/config/aarch64/aarch64-linux.h | 1 +
|
||||
gcc/config/alpha/linux-elf.h | 2 +-
|
||||
gcc/config/arm/linux-elf.h | 1 +
|
||||
gcc/config/gnu-user.h | 6 +++---
|
||||
gcc/config/i386/gnu-user.h | 2 +-
|
||||
gcc/config/i386/gnu-user64.h | 1 +
|
||||
gcc/config/ia64/linux.h | 2 +-
|
||||
gcc/config/mips/gnu-user.h | 1 +
|
||||
gcc/config/riscv/linux.h | 1 +
|
||||
gcc/config/rs6000/linux64.h | 4 ++--
|
||||
gcc/config/rs6000/sysv4.h | 2 +-
|
||||
gcc/config/s390/linux.h | 2 +-
|
||||
gcc/config/sparc/linux.h | 2 +-
|
||||
gcc/gcc.cc | 28 ++++++++++++++++++++--------
|
||||
14 files changed, 36 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
|
||||
index 5e4553d79f5..b516f3ef97f 100644
|
||||
--- a/gcc/config/aarch64/aarch64-linux.h
|
||||
+++ b/gcc/config/aarch64/aarch64-linux.h
|
||||
@@ -35,6 +35,7 @@
|
||||
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
|
||||
|
||||
#define LINUX_TARGET_LINK_SPEC "%{h*} \
|
||||
+ --as-needed \
|
||||
%{static:-Bstatic} \
|
||||
%{shared:-shared} \
|
||||
%{symbolic:-Bsymbolic} \
|
||||
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
|
||||
index 17f16a55910..9ec667e9a5e 100644
|
||||
--- a/gcc/config/alpha/linux-elf.h
|
||||
+++ b/gcc/config/alpha/linux-elf.h
|
||||
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
|
||||
|
||||
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
|
||||
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
|
||||
%{O*:-O3} %{!O*:-O1} \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
|
||||
index df3da67c4f0..7532bc29f9b 100644
|
||||
--- a/gcc/config/arm/linux-elf.h
|
||||
+++ b/gcc/config/arm/linux-elf.h
|
||||
@@ -70,6 +70,7 @@
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
|
||||
-X \
|
||||
+ --as-needed \
|
||||
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
|
||||
SUBTARGET_EXTRA_LINK_SPEC
|
||||
|
||||
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
|
||||
index 857c0e077bf..8433e56c3e1 100644
|
||||
--- a/gcc/config/gnu-user.h
|
||||
+++ b/gcc/config/gnu-user.h
|
||||
@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
|
||||
"%{static-libasan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
|
||||
- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
|
||||
+ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}"
|
||||
#undef LIBHWASAN_EARLY_SPEC
|
||||
#define LIBHWASAN_EARLY_SPEC "%{static-libhwasan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -lhwasan --no-whole-archive " \
|
||||
@@ -145,12 +145,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
#define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
|
||||
"%{static-libtsan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
|
||||
- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
|
||||
+ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
|
||||
#undef LIBLSAN_EARLY_SPEC
|
||||
#define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
|
||||
"%{static-liblsan:%{!shared:" \
|
||||
LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
|
||||
- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
|
||||
+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
|
||||
#endif
|
||||
|
||||
#undef TARGET_F951_OPTIONS
|
||||
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
|
||||
index 0102b2a6f3b..994414c1845 100644
|
||||
--- a/gcc/config/i386/gnu-user.h
|
||||
+++ b/gcc/config/i386/gnu-user.h
|
||||
@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
{ "link_emulation", GNU_USER_LINK_EMULATION },\
|
||||
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
|
||||
|
||||
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
|
||||
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{!static-pie: \
|
||||
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
|
||||
index abc8cf624ca..fe656aeae27 100644
|
||||
--- a/gcc/config/i386/gnu-user64.h
|
||||
+++ b/gcc/config/i386/gnu-user64.h
|
||||
@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
"%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
|
||||
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
|
||||
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
|
||||
+ --as-needed \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
|
||||
index 93510098ccc..3813e536423 100644
|
||||
--- a/gcc/config/ia64/linux.h
|
||||
+++ b/gcc/config/ia64/linux.h
|
||||
@@ -58,7 +58,7 @@ do { \
|
||||
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
|
||||
|
||||
#undef LINK_SPEC
|
||||
-#define LINK_SPEC "\
|
||||
+#define LINK_SPEC " --as-needed \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
|
||||
index 6aad7192e69..e1256a55add 100644
|
||||
--- a/gcc/config/mips/gnu-user.h
|
||||
+++ b/gcc/config/mips/gnu-user.h
|
||||
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
#undef GNU_USER_TARGET_LINK_SPEC
|
||||
#define GNU_USER_TARGET_LINK_SPEC "\
|
||||
%{G*} %{EB} %{EL} %{mips*} %{shared} \
|
||||
+ -as-needed \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
|
||||
index 38803723ba9..3067ed6eac8 100644
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
"%{mabi=ilp32:_ilp32}"
|
||||
|
||||
#define LINK_SPEC "\
|
||||
+-as-needed \
|
||||
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \
|
||||
%{mno-relax:--no-relax} \
|
||||
%{mbig-endian:-EB} \
|
||||
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
|
||||
index b2a7afabc73..34ceb4e4fce 100644
|
||||
--- a/gcc/config/rs6000/linux64.h
|
||||
+++ b/gcc/config/rs6000/linux64.h
|
||||
@@ -377,13 +377,13 @@ extern int dot_symbols;
|
||||
" -m elf64ppc")
|
||||
#endif
|
||||
|
||||
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
|
||||
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \
|
||||
%{!static-pie: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
|
||||
%(link_os_extra_spec32)"
|
||||
|
||||
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
|
||||
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \
|
||||
%{!static-pie: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
|
||||
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
|
||||
index 7e2519de5d4..61215a7a1b3 100644
|
||||
--- a/gcc/config/rs6000/sysv4.h
|
||||
+++ b/gcc/config/rs6000/sysv4.h
|
||||
@@ -788,7 +788,7 @@ GNU_USER_TARGET_CC1_SPEC
|
||||
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
|
||||
#endif
|
||||
|
||||
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
|
||||
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
|
||||
|
||||
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
|
||||
index d7b7e7a7b02..d2287f14f2e 100644
|
||||
--- a/gcc/config/s390/linux.h
|
||||
+++ b/gcc/config/s390/linux.h
|
||||
@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
|
||||
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{static:-static} \
|
||||
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
|
||||
index 6a809e9092d..93bfb92d3ff 100644
|
||||
--- a/gcc/config/sparc/linux.h
|
||||
+++ b/gcc/config/sparc/linux.h
|
||||
@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
|
||||
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
|
||||
|
||||
#undef LINK_SPEC
|
||||
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
|
||||
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
|
||||
%{!mno-relax:%{!r:-relax}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index d18b5d7b59a..3b76311b544 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -744,8 +744,11 @@ proper position among the other output files. */
|
||||
#ifdef LIBASAN_EARLY_SPEC
|
||||
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
|
||||
- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -lasan " \
|
||||
+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBASAN_LIBS
|
||||
#else
|
||||
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
|
||||
@@ -780,8 +783,11 @@ proper position among the other output files. */
|
||||
#ifdef LIBTSAN_EARLY_SPEC
|
||||
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
|
||||
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -ltsan " \
|
||||
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBTSAN_LIBS
|
||||
#else
|
||||
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
|
||||
@@ -798,8 +804,11 @@ proper position among the other output files. */
|
||||
#ifdef LIBLSAN_EARLY_SPEC
|
||||
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
|
||||
- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -llsan " \
|
||||
+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBLSAN_LIBS
|
||||
#else
|
||||
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
|
||||
@@ -814,8 +823,11 @@ proper position among the other output files. */
|
||||
#define STATIC_LIBUBSAN_LIBS \
|
||||
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
|
||||
#ifdef HAVE_LD_STATIC_DYNAMIC
|
||||
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
|
||||
- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
|
||||
+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " -lubsan " \
|
||||
+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
|
||||
+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
STATIC_LIBUBSAN_LIBS
|
||||
#else
|
||||
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
|
||||
@@ -0,0 +1,31 @@
|
||||
From c664283dd30949c5299d1c45bd5740bcfe993d22 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:47:43 +0000
|
||||
Subject: [PATCH] Enable -Wformat and -Wformat-security by default.
|
||||
|
||||
---
|
||||
gcc/c-family/c.opt | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
|
||||
index 07da40ef43b..8683f706426 100644
|
||||
--- a/gcc/c-family/c.opt
|
||||
+++ b/gcc/c-family/c.opt
|
||||
@@ -692,7 +692,7 @@ Warn about function calls with format strings that write past the end
|
||||
of the destination region. Same as -Wformat-overflow=1.
|
||||
|
||||
Wformat-security
|
||||
-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
|
||||
+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
|
||||
Warn about possible security problems with format functions.
|
||||
|
||||
Wformat-signedness
|
||||
@@ -713,7 +713,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
|
||||
Warn about zero-length formats.
|
||||
|
||||
Wformat=
|
||||
-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
|
||||
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
|
||||
Warn about printf/scanf/strftime/strfmon format string anomalies.
|
||||
|
||||
Wformat-overflow=
|
||||
@@ -0,0 +1,22 @@
|
||||
From e4d0ec43e772b6dc7c3708aed5309897df26a125 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:48:24 +0000
|
||||
Subject: [PATCH] Enable -Wtrampolines by default.
|
||||
|
||||
---
|
||||
gcc/common.opt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/common.opt b/gcc/common.opt
|
||||
index 0357868e22c..6d5e5eebe60 100644
|
||||
--- a/gcc/common.opt
|
||||
+++ b/gcc/common.opt
|
||||
@@ -802,7 +802,7 @@ Common Var(warn_system_headers) Warning
|
||||
Do not suppress warnings from system headers.
|
||||
|
||||
Wtrampolines
|
||||
-Common Var(warn_trampolines) Warning
|
||||
+Common Var(warn_trampolines) Init(1) Warning
|
||||
Warn whenever a trampoline is generated.
|
||||
|
||||
Wtrivial-auto-var-init
|
||||
@@ -0,0 +1,50 @@
|
||||
From 27e5d5bd3fed9006a2958d2b09750d15ad07383b Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:49:40 +0000
|
||||
Subject: [PATCH] Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding
|
||||
Change the buffer size.
|
||||
|
||||
---
|
||||
gcc/gcc.cc | 8 +++++++-
|
||||
gcc/params.opt | 2 +-
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 3b76311b544..cc99d0b7aa1 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -996,6 +996,12 @@ proper position among the other output files. */
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
|
||||
#endif
|
||||
|
||||
+#ifdef ENABLE_DEFAULT_SSP
|
||||
+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
|
||||
+#else
|
||||
+#define NO_SSP_SPEC ""
|
||||
+#endif
|
||||
+
|
||||
#ifndef LINK_SSP_SPEC
|
||||
#ifdef TARGET_LIBC_PROVIDES_SSP
|
||||
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
||||
@@ -1295,7 +1301,7 @@ static const char *cc1_options =
|
||||
%{-version:--version}\
|
||||
%{-help=*:--help=%*}\
|
||||
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
|
||||
- %{fsyntax-only:-o %j} %{-param*}\
|
||||
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
|
||||
%{coverage:-fprofile-arcs -ftest-coverage}\
|
||||
%{fprofile-arcs|fprofile-generate*|coverage:\
|
||||
%{!fprofile-update=single:\
|
||||
diff --git a/gcc/params.opt b/gcc/params.opt
|
||||
index b88e1372005..82a7e25dd2f 100644
|
||||
--- a/gcc/params.opt
|
||||
+++ b/gcc/params.opt
|
||||
@@ -1012,7 +1012,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
|
||||
The maximum number of SSA_NAME assignments to follow in determining a value.
|
||||
|
||||
-param=ssp-buffer-size=
|
||||
-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
|
||||
+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
|
||||
The lower bound for a buffer to be considered for stack smashing protection.
|
||||
|
||||
-param=stack-clash-protection-guard-size=
|
||||
@@ -0,0 +1,51 @@
|
||||
From 83bf2a316222e2fe0b72968cadf4e334d41173f6 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:50:33 +0000
|
||||
Subject: [PATCH] Ensure that msgfmt doesn't encounter problems during gcc
|
||||
bootstrapping.
|
||||
|
||||
Solves error messages like the following:
|
||||
|
||||
msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
|
||||
|
||||
The libgcc_s.so used during build doesn't satisfy the needs of the
|
||||
libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
|
||||
is used as a stand-alone application here, and what library it uses
|
||||
behind the scenes is of no concern to the gcc build process.
|
||||
Therefore, simply invoking it "as usual", i.e. without any special
|
||||
library path, will make it work as expected here.
|
||||
|
||||
2011-09-19 Martin von Gagern
|
||||
|
||||
References:
|
||||
https://bugs.gentoo.org/372377
|
||||
https://bugs.gentoo.org/295480
|
||||
---
|
||||
libstdc++-v3/po/Makefile.am | 1 +
|
||||
libstdc++-v3/po/Makefile.in | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am
|
||||
index 8f51544989e..5329804d136 100644
|
||||
--- a/libstdc++-v3/po/Makefile.am
|
||||
+++ b/libstdc++-v3/po/Makefile.am
|
||||
@@ -38,6 +38,7 @@ MSGFMT = msgfmt
|
||||
EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
|
||||
|
||||
.po.mo:
|
||||
+ env --unset=LD_LIBRARY_PATH \
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
all-local: all-local-$(USE_NLS)
|
||||
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
|
||||
index 243f3db7b72..822210781fa 100644
|
||||
--- a/libstdc++-v3/po/Makefile.in
|
||||
+++ b/libstdc++-v3/po/Makefile.in
|
||||
@@ -561,6 +561,7 @@ uninstall-am:
|
||||
|
||||
|
||||
.po.mo:
|
||||
+ env --unset=LD_LIBRARY_PATH \
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
all-local: all-local-$(USE_NLS)
|
||||
@@ -0,0 +1,25 @@
|
||||
From 190064993cd8ddbd48015c1fc1916e4110a97733 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:52:07 +0000
|
||||
Subject: [PATCH] Don't declare asprintf if defined as a macro.
|
||||
|
||||
---
|
||||
include/libiberty.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/libiberty.h b/include/libiberty.h
|
||||
index a65ced9c820..eb20ab0f95f 100644
|
||||
--- a/include/libiberty.h
|
||||
+++ b/include/libiberty.h
|
||||
@@ -652,8 +652,11 @@ extern void *bsearch_r (const void *, const void *,
|
||||
/* Like sprintf but provides a pointer to malloc'd storage, which must
|
||||
be freed by the caller. */
|
||||
|
||||
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
|
||||
+#ifndef asprintf
|
||||
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/* Like asprintf but allocates memory without fail. This works like
|
||||
xmalloc. */
|
||||
@@ -0,0 +1,21 @@
|
||||
From 838e1daa955d9013c462be3471497cb39641e951 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:53:00 +0000
|
||||
Subject: [PATCH] libiberty: copy PIC objects during build process
|
||||
|
||||
---
|
||||
libiberty/Makefile.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
|
||||
index 1b17c2e3a47..8db1176df2e 100644
|
||||
--- a/libiberty/Makefile.in
|
||||
+++ b/libiberty/Makefile.in
|
||||
@@ -265,6 +265,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
|
||||
$(AR) $(AR_FLAGS) $(TARGETLIB) \
|
||||
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
|
||||
$(RANLIB) $(TARGETLIB); \
|
||||
+ cp $(TARGETLIB) ../ ; \
|
||||
cd ..; \
|
||||
else true; fi
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 717346fbbd6642ba6b0c3af2deb3771794346507 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:53:36 +0000
|
||||
Subject: [PATCH] libitm: disable FORTIFY
|
||||
|
||||
---
|
||||
libitm/configure.tgt | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
|
||||
index 06e90973ef3..669e64236c3 100644
|
||||
--- a/libitm/configure.tgt
|
||||
+++ b/libitm/configure.tgt
|
||||
@@ -47,6 +47,16 @@ if test "$gcc_cv_have_tls" = yes ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
+# FIXME: error: inlining failed in call to always_inline
|
||||
+# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’
|
||||
+# : function body can be overwritten at link time
|
||||
+# Disable Fortify in libitm for now. #508852
|
||||
+case "${target}" in
|
||||
+ *-*-linux*)
|
||||
+ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE"
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
# Map the target cpu to an ARCH sub-directory. At the same time,
|
||||
# work out any special compilation flags as necessary.
|
||||
case "${target_cpu}" in
|
||||
@@ -0,0 +1,54 @@
|
||||
From 048c394eb709bfd216e307c1b92ac7f8a7e7758b Mon Sep 17 00:00:00 2001
|
||||
From: Szabolcs Nagy <nsz@port70.net>
|
||||
Date: Sat, 24 Oct 2015 20:09:53 +0000
|
||||
Subject: [PATCH] libgcc_s
|
||||
|
||||
---
|
||||
gcc/config/i386/i386-expand.cc | 4 ++--
|
||||
libgcc/config/i386/cpuinfo.c | 6 +++---
|
||||
libgcc/config/i386/t-linux | 2 +-
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
|
||||
index 31780b6daf7..d89898846e1 100644
|
||||
--- a/gcc/config/i386/i386-expand.cc
|
||||
+++ b/gcc/config/i386/i386-expand.cc
|
||||
@@ -12338,10 +12338,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
|
||||
{
|
||||
case IX86_BUILTIN_CPU_INIT:
|
||||
{
|
||||
- /* Make it call __cpu_indicator_init in libgcc. */
|
||||
+ /* Make it call __cpu_indicator_init in libgcc.a. */
|
||||
tree call_expr, fndecl, type;
|
||||
type = build_function_type_list (integer_type_node, NULL_TREE);
|
||||
- fndecl = build_fn_decl ("__cpu_indicator_init", type);
|
||||
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
|
||||
call_expr = build_call_expr (fndecl, 0);
|
||||
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
|
||||
}
|
||||
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
|
||||
index dab1d98060f..cf824b4114a 100644
|
||||
--- a/libgcc/config/i386/cpuinfo.c
|
||||
+++ b/libgcc/config/i386/cpuinfo.c
|
||||
@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
|
||||
__cpu_features2);
|
||||
}
|
||||
|
||||
-#if defined SHARED && defined USE_ELF_SYMVER
|
||||
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
|
||||
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
|
||||
+#ifndef SHARED
|
||||
+int __cpu_indicator_init_local (void)
|
||||
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
|
||||
#endif
|
||||
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
|
||||
index 8506a635790..564296f788e 100644
|
||||
--- a/libgcc/config/i386/t-linux
|
||||
+++ b/libgcc/config/i386/t-linux
|
||||
@@ -3,5 +3,5 @@
|
||||
# t-slibgcc-elf-ver and t-linux
|
||||
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
|
||||
|
||||
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
|
||||
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
|
||||
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
|
||||
@@ -0,0 +1,72 @@
|
||||
From db28b1e0f3b06325026ec5b5e7cdca4e9992e05c Mon Sep 17 00:00:00 2001
|
||||
From: Szabolcs Nagy <nsz@port70.net>
|
||||
Date: Sat, 7 Nov 2015 02:08:05 +0000
|
||||
Subject: [PATCH] nopie
|
||||
|
||||
---
|
||||
gcc/configure | 27 +++++++++++++++++++++++++++
|
||||
gcc/configure.ac | 13 +++++++++++++
|
||||
2 files changed, 40 insertions(+)
|
||||
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index e9060112384..2f6b3265a6c 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -32497,6 +32497,33 @@ fi
|
||||
$as_echo "$gcc_cv_no_pie" >&6; }
|
||||
if test "$gcc_cv_no_pie" = "yes"; then
|
||||
NO_PIE_FLAG="-no-pie"
|
||||
+else
|
||||
+ # Check if -nopie works.
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
|
||||
+$as_echo_n "checking for -nopie option... " >&6; }
|
||||
+if test "${gcc_cv_nopie+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ saved_LDFLAGS="$LDFLAGS"
|
||||
+ LDFLAGS="$LDFLAGS -nopie"
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+int main(void) {return 0;}
|
||||
+_ACEOF
|
||||
+if ac_fn_cxx_try_link "$LINENO"; then :
|
||||
+ gcc_cv_nopie=yes
|
||||
+else
|
||||
+ gcc_cv_nopie=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+ LDFLAGS="$saved_LDFLAGS"
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
|
||||
+$as_echo "$gcc_cv_nopie" >&6; }
|
||||
+ if test "$gcc_cv_nopie" = "yes"; then
|
||||
+ NO_PIE_FLAG="-nopie"
|
||||
+ fi
|
||||
fi
|
||||
|
||||
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index 75a7048045c..e683d3a7a5f 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -7681,6 +7681,19 @@ AC_CACHE_CHECK([for -no-pie option],
|
||||
LDFLAGS="$saved_LDFLAGS"])
|
||||
if test "$gcc_cv_no_pie" = "yes"; then
|
||||
NO_PIE_FLAG="-no-pie"
|
||||
+else
|
||||
+ # Check if -nopie works.
|
||||
+ AC_CACHE_CHECK([for -nopie option],
|
||||
+ [gcc_cv_nopie],
|
||||
+ [saved_LDFLAGS="$LDFLAGS"
|
||||
+ LDFLAGS="$LDFLAGS -nopie"
|
||||
+ AC_LINK_IFELSE([int main(void) {return 0;}],
|
||||
+ [gcc_cv_nopie=yes],
|
||||
+ [gcc_cv_nopie=no])
|
||||
+ LDFLAGS="$saved_LDFLAGS"])
|
||||
+ if test "$gcc_cv_nopie" = "yes"; then
|
||||
+ NO_PIE_FLAG="-nopie"
|
||||
+ fi
|
||||
fi
|
||||
AC_SUBST([NO_PIE_FLAG])
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
From 686e85d8a05f9f9e6c983afb13f937bd88fe84dd Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:18:32 +0000
|
||||
Subject: [PATCH] dlang: use libucontext on mips64
|
||||
|
||||
---
|
||||
libphobos/configure.tgt | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
|
||||
index 0063dd23249..c5e782a1238 100644
|
||||
--- a/libphobos/configure.tgt
|
||||
+++ b/libphobos/configure.tgt
|
||||
@@ -38,6 +38,7 @@ case "${target}" in
|
||||
;;
|
||||
mips*-*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
|
||||
;;
|
||||
power*-*-freebsd*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
@@ -0,0 +1,39 @@
|
||||
From fd642f8cd61849a9dc169588be5562ceda96a889 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:59:16 +0000
|
||||
Subject: [PATCH] ada: fix shared linking
|
||||
|
||||
---
|
||||
gcc/ada/link.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gcc/ada/link.c b/gcc/ada/link.c
|
||||
index a7574efb472..0ad0d66463c 100644
|
||||
--- a/gcc/ada/link.c
|
||||
+++ b/gcc/ada/link.c
|
||||
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
|
||||
|| defined (__NetBSD__) || defined (__OpenBSD__) \
|
||||
|| defined (__QNX__)
|
||||
const char *__gnat_object_file_option = "-Wl,@";
|
||||
-const char *__gnat_run_path_option = "-Wl,-rpath,";
|
||||
-char __gnat_shared_libgnat_default = STATIC;
|
||||
-char __gnat_shared_libgcc_default = STATIC;
|
||||
+const char *__gnat_run_path_option = "";
|
||||
+char __gnat_shared_libgnat_default = SHARED;
|
||||
+char __gnat_shared_libgcc_default = SHARED;
|
||||
int __gnat_link_max = 8192;
|
||||
unsigned char __gnat_objlist_file_supported = 1;
|
||||
const char *__gnat_object_library_extension = ".a";
|
||||
@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
|
||||
|
||||
#elif defined (__linux__) || defined (__GLIBC__)
|
||||
const char *__gnat_object_file_option = "-Wl,@";
|
||||
-const char *__gnat_run_path_option = "-Wl,-rpath,";
|
||||
-char __gnat_shared_libgnat_default = STATIC;
|
||||
-char __gnat_shared_libgcc_default = STATIC;
|
||||
+const char *__gnat_run_path_option = "";
|
||||
+char __gnat_shared_libgnat_default = SHARED;
|
||||
+char __gnat_shared_libgcc_default = SHARED;
|
||||
int __gnat_link_max = 8192;
|
||||
unsigned char __gnat_objlist_file_supported = 1;
|
||||
const char *__gnat_object_library_extension = ".a";
|
||||
@@ -0,0 +1,21 @@
|
||||
From a547632f5c7caec4a164e8d5e5b568fb7a461365 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 06:59:43 +0000
|
||||
Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing
|
||||
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 593495e1650..b96f60e33e2 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -176,6 +176,7 @@ BUILD_EXPORTS = \
|
||||
# built for the build system to override those in BASE_FLAGS_TO_PASS.
|
||||
EXTRA_BUILD_FLAGS = \
|
||||
CFLAGS="$(CFLAGS_FOR_BUILD)" \
|
||||
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
|
||||
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
|
||||
|
||||
# This is the list of directories to built for the host system.
|
||||
@@ -0,0 +1,22 @@
|
||||
From 5bd37f8ee93a0fe1a3f841f48ed6626e7e0aa19d Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:01:06 +0000
|
||||
Subject: [PATCH] add fortify-headers paths
|
||||
|
||||
---
|
||||
gcc/config/linux.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
|
||||
index 74f70793d90..61b07f319f6 100644
|
||||
--- a/gcc/config/linux.h
|
||||
+++ b/gcc/config/linux.h
|
||||
@@ -172,6 +172,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
|
||||
#ifdef NATIVE_SYSTEM_HEADER_DIR
|
||||
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
|
||||
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
|
||||
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
|
||||
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
|
||||
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
|
||||
#else
|
||||
@@ -0,0 +1,28 @@
|
||||
From d2577dc78a1f159e5c41fd0b53e73fa0e264cb52 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
|
||||
Date: Fri, 21 Aug 2020 07:03:00 +0000
|
||||
Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to
|
||||
it unconditionally, as otherwise we get link failures if some objects are
|
||||
-fstack-protector built and final link happens with -fno-stack-protector.
|
||||
This seems to be the common case when bootstrapping gcc, the piepatches do
|
||||
not seem to fully fix the crosstoolchain and bootstrap sequence wrt.
|
||||
stack-protector flag usage.
|
||||
|
||||
---
|
||||
gcc/gcc.cc | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index cc99d0b7aa1..c60a75371f8 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -1004,8 +1004,7 @@ proper position among the other output files. */
|
||||
|
||||
#ifndef LINK_SSP_SPEC
|
||||
#ifdef TARGET_LIBC_PROVIDES_SSP
|
||||
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
||||
- "|fstack-protector-strong|fstack-protector-explicit:}"
|
||||
+#define LINK_SSP_SPEC "-lssp_nonshared"
|
||||
#else
|
||||
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
||||
"|fstack-protector-strong|fstack-protector-explicit" \
|
||||
@@ -0,0 +1,66 @@
|
||||
From bbd5c529ef878c2d6096fd4949616714eb82683a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:03:42 +0000
|
||||
Subject: [PATCH] DP: Use --push-state/--pop-state for gold as well when
|
||||
linking libtsan.
|
||||
|
||||
---
|
||||
gcc/gcc.cc | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index c60a75371f8..735b2b1bba1 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -745,10 +745,10 @@ proper position among the other output files. */
|
||||
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-libasan:--push-state --no-as-needed}" \
|
||||
" -lasan " \
|
||||
" %{static-libasan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-libasan:--pop-state}" \
|
||||
STATIC_LIBASAN_LIBS
|
||||
#else
|
||||
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
|
||||
@@ -784,10 +784,10 @@ proper position among the other output files. */
|
||||
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-libtsan:--push-state --no-as-needed}" \
|
||||
" -ltsan " \
|
||||
" %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-libtsan:--pop-state}" \
|
||||
STATIC_LIBTSAN_LIBS
|
||||
#else
|
||||
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
|
||||
@@ -805,10 +805,10 @@ proper position among the other output files. */
|
||||
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
|
||||
#elif defined(HAVE_LD_STATIC_DYNAMIC)
|
||||
#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-liblsan:--push-state --no-as-needed}" \
|
||||
" -llsan " \
|
||||
" %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-liblsan:--pop-state}" \
|
||||
STATIC_LIBLSAN_LIBS
|
||||
#else
|
||||
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
|
||||
@@ -824,10 +824,10 @@ proper position among the other output files. */
|
||||
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
|
||||
#ifdef HAVE_LD_STATIC_DYNAMIC
|
||||
#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
|
||||
- " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
|
||||
+ " %{!static-libubsan:--push-state --no-as-needed}" \
|
||||
" -lubsan " \
|
||||
" %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
|
||||
- " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
|
||||
+ " %{!static-libubsan:--pop-state}" \
|
||||
STATIC_LIBUBSAN_LIBS
|
||||
#else
|
||||
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
|
||||
@@ -0,0 +1,45 @@
|
||||
From 714ed6d9649bf9ed42e34fef9c41169921e63921 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Andreas Svee <me@lochnair.net>
|
||||
Date: Thu, 21 Dec 2017 03:14:33 +0100
|
||||
Subject: [PATCH] mips64: disable multilib support
|
||||
|
||||
multilib is not supported by Alpine GCC
|
||||
---
|
||||
gcc/config/mips/mips.h | 8 ++++----
|
||||
gcc/config/mips/t-linux64 | 6 +++---
|
||||
2 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
|
||||
index 858bbba3a36..2d4f553e652 100644
|
||||
--- a/gcc/config/mips/mips.h
|
||||
+++ b/gcc/config/mips/mips.h
|
||||
@@ -3447,11 +3447,11 @@ struct GTY(()) machine_function {
|
||||
/* If we are *not* using multilibs and the default ABI is not ABI_32 we
|
||||
need to change these from /lib and /usr/lib. */
|
||||
#if MIPS_ABI_DEFAULT == ABI_N32
|
||||
-#define STANDARD_STARTFILE_PREFIX_1 "/lib32/"
|
||||
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/"
|
||||
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
|
||||
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
|
||||
#elif MIPS_ABI_DEFAULT == ABI_64
|
||||
-#define STANDARD_STARTFILE_PREFIX_1 "/lib64/"
|
||||
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/"
|
||||
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
|
||||
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
|
||||
#endif
|
||||
|
||||
/* Load store bonding is not supported by micromips and fix_24k. The
|
||||
diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
|
||||
index 2fdd8e00407..406a3676289 100644
|
||||
--- a/gcc/config/mips/t-linux64
|
||||
+++ b/gcc/config/mips/t-linux64
|
||||
@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64
|
||||
MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
|
||||
MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
|
||||
MULTILIB_OSDIRNAMES = \
|
||||
- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
|
||||
- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
|
||||
- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
|
||||
+ ../lib \
|
||||
+ ../lib32 \
|
||||
+ ../lib
|
||||
@@ -0,0 +1,23 @@
|
||||
From 8fc8d6c26a2a45945182e211bc3ac2eae4d6a11b Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:12:55 +0000
|
||||
Subject: [PATCH] aarch64: disable multilib support
|
||||
|
||||
multilib is unsupported on Alpine GCC
|
||||
---
|
||||
gcc/config/aarch64/t-aarch64-linux | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
|
||||
index d0cd546002a..b63a77f4969 100644
|
||||
--- a/gcc/config/aarch64/t-aarch64-linux
|
||||
+++ b/gcc/config/aarch64/t-aarch64-linux
|
||||
@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _aarch64_sync_cache_range
|
||||
|
||||
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
|
||||
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
|
||||
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
|
||||
|
||||
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
|
||||
@@ -0,0 +1,22 @@
|
||||
From 65ad898df141261a1ccd891a99133ad8f9847133 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:13:59 +0000
|
||||
Subject: [PATCH] s390x: disable multilib support
|
||||
|
||||
multilib is not supported on Alpine GCC at present
|
||||
---
|
||||
gcc/config/s390/t-linux64 | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/s390/t-linux64 b/gcc/config/s390/t-linux64
|
||||
index cc6ab367072..7f498ee1cdc 100644
|
||||
--- a/gcc/config/s390/t-linux64
|
||||
+++ b/gcc/config/s390/t-linux64
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
MULTILIB_OPTIONS = m64/m31
|
||||
MULTILIB_DIRNAMES = 64 32
|
||||
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
|
||||
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES = m64=../lib
|
||||
+MULTILIB_OSDIRNAMES+= m32=../lib32
|
||||
@@ -0,0 +1,78 @@
|
||||
From 3263d8634da6d7e1edb1bfd88e1b2627ce0aa1be Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:14:33 +0000
|
||||
Subject: [PATCH] ppc64[le]: disable multilib support
|
||||
|
||||
multilib is not presently supported on Alpine GCC
|
||||
---
|
||||
gcc/config/rs6000/t-linux | 6 ++++--
|
||||
gcc/config/rs6000/t-linux64 | 4 ++--
|
||||
gcc/config/rs6000/t-linux64bele | 4 ++--
|
||||
gcc/config/rs6000/t-linux64lebe | 4 ++--
|
||||
4 files changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux
|
||||
index 4e371255533..128c75c7d39 100644
|
||||
--- a/gcc/config/rs6000/t-linux
|
||||
+++ b/gcc/config/rs6000/t-linux
|
||||
@@ -2,7 +2,8 @@
|
||||
# or soft-float.
|
||||
ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
|
||||
ifneq (,$(findstring powerpc64,$(target)))
|
||||
-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
else
|
||||
MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
|
||||
endif
|
||||
@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target)))
|
||||
MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
|
||||
endif
|
||||
ifneq (,$(findstring powerpc64le,$(target)))
|
||||
-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
endif
|
||||
endif
|
||||
|
||||
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
|
||||
index 47e0efd5764..f89729af64f 100644
|
||||
--- a/gcc/config/rs6000/t-linux64
|
||||
+++ b/gcc/config/rs6000/t-linux64
|
||||
@@ -28,8 +28,8 @@
|
||||
MULTILIB_OPTIONS := m64/m32
|
||||
MULTILIB_DIRNAMES := 64 32
|
||||
MULTILIB_EXTRA_OPTS :=
|
||||
-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
|
||||
-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
|
||||
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc
|
||||
$(COMPILE) $<
|
||||
diff --git a/gcc/config/rs6000/t-linux64bele b/gcc/config/rs6000/t-linux64bele
|
||||
index 97c1ee6fb4d..08d72639cb6 100644
|
||||
--- a/gcc/config/rs6000/t-linux64bele
|
||||
+++ b/gcc/config/rs6000/t-linux64bele
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
MULTILIB_OPTIONS += mlittle
|
||||
MULTILIB_DIRNAMES += le
|
||||
-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
|
||||
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
|
||||
+MULTILIB_OSDIRNAMES = m64=../lib
|
||||
+MULTILIB_OSDIRNAMES+= m32=../lib32
|
||||
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
|
||||
diff --git a/gcc/config/rs6000/t-linux64lebe b/gcc/config/rs6000/t-linux64lebe
|
||||
index 2e63bdb9fc9..c6e1c5db65d 100644
|
||||
--- a/gcc/config/rs6000/t-linux64lebe
|
||||
+++ b/gcc/config/rs6000/t-linux64lebe
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
MULTILIB_OPTIONS += mbig
|
||||
MULTILIB_DIRNAMES += be
|
||||
-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
|
||||
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
|
||||
+MULTILIB_OSDIRNAMES := m64=../lib
|
||||
+MULTILIB_OSDIRNAMES += m32=../lib32
|
||||
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
|
||||
@@ -0,0 +1,23 @@
|
||||
From bf63353ea679e0bbf2c2f17bb64c75ebd590c6e7 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Thu, 6 Jan 2022 03:14:54 +0000
|
||||
Subject: [PATCH] x86_64: disable multilib support
|
||||
|
||||
multilib is not presently supported on Alpine GCC
|
||||
---
|
||||
gcc/config/i386/t-linux64 | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
|
||||
index 5526ad0e6cc..78866afab36 100644
|
||||
--- a/gcc/config/i386/t-linux64
|
||||
+++ b/gcc/config/i386/t-linux64
|
||||
@@ -33,6 +33,6 @@
|
||||
comma=,
|
||||
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
|
||||
MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
|
||||
-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
|
||||
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
|
||||
+MULTILIB_OSDIRNAMES = m64=../lib
|
||||
+MULTILIB_OSDIRNAMES+= m32=../lib32
|
||||
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
|
||||
@@ -0,0 +1,71 @@
|
||||
From 2eed19787020ce52cf07b76a5d167c420ec42b61 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Mon, 3 Jan 2022 07:14:48 +0100
|
||||
Subject: [PATCH] riscv: disable multilib support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
From the musl wiki [1]:
|
||||
|
||||
musl does not support sharing an include directory between archs
|
||||
[…], and thus is not compatible with GCC-style multilib. It is
|
||||
recommended that distributions build GCC with multilib disabled,
|
||||
and use library directories named lib, not lib64 or lib32.
|
||||
|
||||
For this reason, we patch existing GCC configuration files (gcc/config)
|
||||
to pin MULTILIB_OSDIRNAMES to lib, there is also a corresponding GCC
|
||||
upstream bug about this issue [2]. Avoiding the use of lib64 and lib32
|
||||
directories is a bit more difficult on the RISC-V architecture. This is
|
||||
due to the fact that the default RISC-V configuration does not only use
|
||||
the lib64 and lib32 directories but also subdirectories within these
|
||||
directories for different RISC-V ABIs (e.g. lp64d, lp64, …) [3].
|
||||
|
||||
This patch aligns the RISC-V configuration with other architectures by
|
||||
pinning MULTILIB_OSDIRNAMES to lib for rv64gc (our default RISC-V
|
||||
-march). Furthermore, this patch removes the ABI-specific startfile
|
||||
prefix spec. Since both of these impact the default LIBRARY_PATH [4]
|
||||
this patch thereby aligns the default RISC-V LIBRARY_PATH with that from
|
||||
other Alpine architectures and thereby fixes #13369 [5].
|
||||
|
||||
Incidentally, this also fixes gccgo on riscv64, as without this patch
|
||||
gccgo is otherwise not able to find the *.gox files for the Go standard
|
||||
library.
|
||||
|
||||
[1]: https://wiki.musl-libc.org/guidelines-for-distributions.html#Multilib/multi_arch
|
||||
[2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90077
|
||||
[3]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103889#c14
|
||||
[4]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.c;h=d4c8746b0aa322286decf92aa72a12f0a393b655;hb=HEAD#l9122
|
||||
[5]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13369
|
||||
---
|
||||
gcc/config/riscv/linux.h | 6 ------
|
||||
gcc/config/riscv/t-linux | 7 +++++--
|
||||
2 files changed, 5 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
|
||||
index 3067ed6eac8..4c8c85e3285 100644
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -71,9 +71,3 @@ along with GCC; see the file COPYING3. If not see
|
||||
%{static:-static}}"
|
||||
|
||||
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
|
||||
-
|
||||
-#define STARTFILE_PREFIX_SPEC \
|
||||
- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
|
||||
- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
|
||||
- "/lib/ " \
|
||||
- "/usr/lib/ "
|
||||
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
|
||||
index 216d2776a18..1a8a863853e 100644
|
||||
--- a/gcc/config/riscv/t-linux
|
||||
+++ b/gcc/config/riscv/t-linux
|
||||
@@ -1,3 +1,6 @@
|
||||
-# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
|
||||
-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
|
||||
+MULTILIB_OPTIONS := march=rv64gc
|
||||
+MULTILIB_DIRNAMES := rv64gc
|
||||
+
|
||||
+MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib,$(MULTILIB_DIRNAMES)))
|
||||
MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
|
||||
+MULTILIB_MATCHES := march?rv64gc=march?rv64imafdc
|
||||
@@ -0,0 +1,48 @@
|
||||
From 51a35c0fa0e793c6a2c64ae1449c0cfd681d8f8a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:05:41 +0000
|
||||
Subject: [PATCH] always build libgcc_eh.a
|
||||
|
||||
highly inspired by:
|
||||
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
|
||||
---
|
||||
libgcc/Makefile.in | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
|
||||
index 09b3ec8bc2e..c9ca58c64cc 100644
|
||||
--- a/libgcc/Makefile.in
|
||||
+++ b/libgcc/Makefile.in
|
||||
@@ -957,8 +957,9 @@ ifneq ($(LIBUNWIND),)
|
||||
all: libunwind.a
|
||||
endif
|
||||
|
||||
+all: libgcc_eh.a
|
||||
ifeq ($(enable_shared),yes)
|
||||
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
|
||||
+all: libgcc_s$(SHLIB_EXT)
|
||||
ifneq ($(LIBUNWIND),)
|
||||
all: libunwind$(SHLIB_EXT)
|
||||
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
|
||||
@@ -1160,10 +1161,6 @@ install-libunwind:
|
||||
install-shared:
|
||||
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
|
||||
|
||||
- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
|
||||
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
-
|
||||
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
|
||||
@shlib_base_name@,libgcc_s,$(subst \
|
||||
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
|
||||
@@ -1180,6 +1177,10 @@ ifeq ($(enable_gcov),yes)
|
||||
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
|
||||
endif
|
||||
|
||||
+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
|
||||
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
|
||||
+
|
||||
parts="$(INSTALL_PARTS)"; \
|
||||
for file in $$parts; do \
|
||||
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
|
||||
@@ -0,0 +1,132 @@
|
||||
From 64a1c5f57e278869f41c43ee56cc5defb3dd55c5 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:06:30 +0000
|
||||
Subject: [PATCH] ada: libgnarl compatibility for musl
|
||||
|
||||
---
|
||||
gcc/ada/libgnarl/s-osinte__linux.ads | 11 ------
|
||||
gcc/ada/libgnarl/s-taprop__linux.adb | 53 ++--------------------------
|
||||
2 files changed, 3 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
|
||||
index 7c9e7ca4518..caafc4aa68f 100644
|
||||
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
|
||||
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
|
||||
@@ -403,12 +403,6 @@ package System.OS_Interface is
|
||||
PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
|
||||
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
|
||||
|
||||
- function pthread_rwlockattr_setkind_np
|
||||
- (attr : access pthread_rwlockattr_t;
|
||||
- pref : int) return int;
|
||||
- pragma Import
|
||||
- (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
|
||||
-
|
||||
function pthread_rwlock_init
|
||||
(mutex : access pthread_rwlock_t;
|
||||
attr : access pthread_rwlockattr_t) return int;
|
||||
@@ -470,11 +464,6 @@ package System.OS_Interface is
|
||||
protocol : int) return int;
|
||||
pragma Import (C, pthread_mutexattr_setprotocol);
|
||||
|
||||
- function pthread_mutexattr_setprioceiling
|
||||
- (attr : access pthread_mutexattr_t;
|
||||
- prioceiling : int) return int;
|
||||
- pragma Import (C, pthread_mutexattr_setprioceiling);
|
||||
-
|
||||
type struct_sched_param is record
|
||||
sched_priority : int; -- scheduling priority
|
||||
end record;
|
||||
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
|
||||
index 4ff784f0ea7..b34a12802c6 100644
|
||||
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
|
||||
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
|
||||
@@ -198,9 +198,6 @@ package body System.Task_Primitives.Operations is
|
||||
pragma Import
|
||||
(C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
|
||||
|
||||
- function GNAT_has_cap_sys_nice return C.int;
|
||||
- pragma Import
|
||||
- (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
|
||||
-- We do not have pragma Linker_Options ("-lcap"); here, because this
|
||||
-- library is not present on many Linux systems. 'libcap' is the Linux
|
||||
-- "capabilities" library, called by __gnat_has_cap_sys_nice.
|
||||
@@ -210,38 +207,6 @@ package body System.Task_Primitives.Operations is
|
||||
-- Convert Ada priority to Linux priority. Priorities are 1 .. 99 on
|
||||
-- GNU/Linux, so we map 0 .. 98 to 1 .. 99.
|
||||
|
||||
- function Get_Ceiling_Support return Boolean;
|
||||
- -- Get the value of the Ceiling_Support constant (see below).
|
||||
- -- Note well: If this function or related code is modified, it should be
|
||||
- -- tested by hand, because automated testing doesn't exercise it.
|
||||
-
|
||||
- -------------------------
|
||||
- -- Get_Ceiling_Support --
|
||||
- -------------------------
|
||||
-
|
||||
- function Get_Ceiling_Support return Boolean is
|
||||
- Ceiling_Support : Boolean := False;
|
||||
- begin
|
||||
- if Locking_Policy /= 'C' then
|
||||
- return False;
|
||||
- end if;
|
||||
-
|
||||
- declare
|
||||
- function geteuid return Integer;
|
||||
- pragma Import (C, geteuid, "geteuid");
|
||||
- Superuser : constant Boolean := geteuid = 0;
|
||||
- Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
|
||||
- pragma Assert (Has_Cap in 0 | 1);
|
||||
- begin
|
||||
- Ceiling_Support := Superuser or else Has_Cap = 1;
|
||||
- end;
|
||||
-
|
||||
- return Ceiling_Support;
|
||||
- end Get_Ceiling_Support;
|
||||
-
|
||||
- pragma Warnings (Off, "non-preelaborable call not allowed*");
|
||||
- Ceiling_Support : constant Boolean := Get_Ceiling_Support;
|
||||
- pragma Warnings (On, "non-preelaborable call not allowed*");
|
||||
-- True if the locking policy is Ceiling_Locking, and the current process
|
||||
-- has permission to use this policy. The process has permission if it is
|
||||
-- running as 'root', or if the capability was set by the setcap command,
|
||||
@@ -344,7 +309,9 @@ package body System.Task_Primitives.Operations is
|
||||
-- Init_Mutex --
|
||||
----------------
|
||||
|
||||
+ pragma Warnings (Off, "formal parameter * is not referenced");
|
||||
function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
|
||||
+ pragma Warnings (On, "formal parameter * is not referenced");
|
||||
Mutex_Attr : aliased pthread_mutexattr_t;
|
||||
Result, Result_2 : C.int;
|
||||
|
||||
@@ -356,16 +323,7 @@ package body System.Task_Primitives.Operations is
|
||||
return Result;
|
||||
end if;
|
||||
|
||||
- if Ceiling_Support then
|
||||
- Result := pthread_mutexattr_setprotocol
|
||||
- (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
|
||||
- pragma Assert (Result = 0);
|
||||
-
|
||||
- Result := pthread_mutexattr_setprioceiling
|
||||
- (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
|
||||
- pragma Assert (Result = 0);
|
||||
-
|
||||
- elsif Locking_Policy = 'I' then
|
||||
+ if Locking_Policy = 'I' then
|
||||
Result := pthread_mutexattr_setprotocol
|
||||
(Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
|
||||
pragma Assert (Result = 0);
|
||||
@@ -405,11 +363,6 @@ package body System.Task_Primitives.Operations is
|
||||
Result := pthread_rwlockattr_init (RWlock_Attr'Access);
|
||||
pragma Assert (Result = 0);
|
||||
|
||||
- Result := pthread_rwlockattr_setkind_np
|
||||
- (RWlock_Attr'Access,
|
||||
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
- pragma Assert (Result = 0);
|
||||
-
|
||||
Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
|
||||
|
||||
pragma Assert (Result in 0 | ENOMEM);
|
||||
@@ -0,0 +1,220 @@
|
||||
From 82addb1312f4f58a412a664228944009aa5cb569 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Fri, 21 Aug 2020 07:07:48 +0000
|
||||
Subject: [PATCH] ada: musl support fixes
|
||||
|
||||
---
|
||||
gcc/ada/Makefile.rtl | 10 +++++-----
|
||||
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
|
||||
gcc/ada/adaint.h | 10 ++++------
|
||||
gcc/ada/terminals.c | 8 ++++----
|
||||
4 files changed, 32 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
|
||||
index aaf853e3a2a..e2dd3587ed5 100644
|
||||
--- a/gcc/ada/Makefile.rtl
|
||||
+++ b/gcc/ada/Makefile.rtl
|
||||
@@ -1633,7 +1633,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
|
||||
s-intman.adb<libgnarl/s-intman__posix.adb \
|
||||
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
|
||||
$(TRASYM_DWARF_UNIX_PAIRS) \
|
||||
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
|
||||
+ s-tsmona.adb<libgnat/s-tsmona.adb \
|
||||
a-exetim.adb<libgnarl/a-exetim__posix.adb \
|
||||
a-exetim.ads<libgnarl/a-exetim__default.ads \
|
||||
s-linux.ads<libgnarl/s-linux.ads \
|
||||
@@ -2258,7 +2258,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
|
||||
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
|
||||
s-taspri.ads<libgnarl/s-taspri__posix.ads \
|
||||
$(TRASYM_DWARF_UNIX_PAIRS) \
|
||||
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
|
||||
+ s-tsmona.adb<libgnat/s-tsmona.adb \
|
||||
$(ATOMICS_TARGET_PAIRS) \
|
||||
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
|
||||
system.ads<libgnat/system-linux-ppc.ads
|
||||
@@ -2289,7 +2289,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
|
||||
endif
|
||||
|
||||
# ARM linux, GNU eabi
|
||||
-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
|
||||
+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
|
||||
LIBGNAT_TARGET_PAIRS = \
|
||||
a-intnam.ads<libgnarl/a-intnam__linux.ads \
|
||||
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
|
||||
@@ -2504,7 +2504,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
|
||||
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
|
||||
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
|
||||
$(TRASYM_DWARF_UNIX_PAIRS) \
|
||||
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
|
||||
+ s-tsmona.adb<libgnat/s-tsmona.adb \
|
||||
$(ATOMICS_TARGET_PAIRS) \
|
||||
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
|
||||
$(GNATRTL_128BIT_PAIRS) \
|
||||
@@ -2608,7 +2608,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
|
||||
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
|
||||
s-taspri.ads<libgnarl/s-taspri__posix.ads \
|
||||
$(TRASYM_DWARF_UNIX_PAIRS) \
|
||||
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
|
||||
+ s-tsmona.adb<libgnat/s-tsmona.adb \
|
||||
$(ATOMICS_TARGET_PAIRS) \
|
||||
$(X86_64_TARGET_PAIRS) \
|
||||
$(GNATRTL_128BIT_PAIRS) \
|
||||
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
|
||||
index 591d033fbca..a485cbf15b9 100644
|
||||
--- a/gcc/ada/adaint.c
|
||||
+++ b/gcc/ada/adaint.c
|
||||
@@ -91,6 +91,11 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/pstat.h>
|
||||
#endif
|
||||
+
|
||||
+#if defined (linux) || defined(__linux__)
|
||||
+#define _GNU_SOURCE 1
|
||||
+#include <sched.h>
|
||||
+#endif
|
||||
|
||||
#ifdef __PikeOS__
|
||||
#define __BSD_VISIBLE 1
|
||||
@@ -3446,7 +3451,6 @@ __gnat_lwp_self (void)
|
||||
#endif
|
||||
|
||||
#if defined (__linux__)
|
||||
-#include <sched.h>
|
||||
|
||||
/* glibc versions earlier than 2.7 do not define the routines to handle
|
||||
dynamically allocated CPU sets. For these targets, we use the static
|
||||
@@ -3456,7 +3460,7 @@ __gnat_lwp_self (void)
|
||||
|
||||
/* Dynamic cpu sets */
|
||||
|
||||
-cpu_set_t *
|
||||
+void *
|
||||
__gnat_cpu_alloc (size_t count)
|
||||
{
|
||||
return CPU_ALLOC (count);
|
||||
@@ -3469,33 +3473,33 @@ __gnat_cpu_alloc_size (size_t count)
|
||||
}
|
||||
|
||||
void
|
||||
-__gnat_cpu_free (cpu_set_t *set)
|
||||
+__gnat_cpu_free (void *set)
|
||||
{
|
||||
- CPU_FREE (set);
|
||||
+ CPU_FREE ((cpu_set_t *) set);
|
||||
}
|
||||
|
||||
void
|
||||
-__gnat_cpu_zero (size_t count, cpu_set_t *set)
|
||||
+__gnat_cpu_zero (size_t count, void *set)
|
||||
{
|
||||
- CPU_ZERO_S (count, set);
|
||||
+ CPU_ZERO_S (count, (cpu_set_t *) set);
|
||||
}
|
||||
|
||||
void
|
||||
-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
|
||||
+__gnat_cpu_set (int cpu, size_t count, void *set)
|
||||
{
|
||||
/* Ada handles CPU numbers starting from 1, while C identifies the first
|
||||
CPU by a 0, so we need to adjust. */
|
||||
- CPU_SET_S (cpu - 1, count, set);
|
||||
+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
|
||||
}
|
||||
|
||||
#else /* !CPU_ALLOC */
|
||||
|
||||
/* Static cpu sets */
|
||||
|
||||
-cpu_set_t *
|
||||
+void *
|
||||
__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
|
||||
{
|
||||
- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
|
||||
+ return xmalloc (sizeof (cpu_set_t));
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -3505,23 +3509,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
void
|
||||
-__gnat_cpu_free (cpu_set_t *set)
|
||||
+__gnat_cpu_free (void *set)
|
||||
{
|
||||
free (set);
|
||||
}
|
||||
|
||||
void
|
||||
-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
|
||||
+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
|
||||
{
|
||||
- CPU_ZERO (set);
|
||||
+ CPU_ZERO ((cpu_set_t *) set);
|
||||
}
|
||||
|
||||
void
|
||||
-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
|
||||
+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
|
||||
{
|
||||
/* Ada handles CPU numbers starting from 1, while C identifies the first
|
||||
CPU by a 0, so we need to adjust. */
|
||||
- CPU_SET (cpu - 1, set);
|
||||
+ CPU_SET (cpu - 1, (cpu_set_t *) set);
|
||||
}
|
||||
#endif /* !CPU_ALLOC */
|
||||
#endif /* __linux__ */
|
||||
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
|
||||
index 2631be5ad3e..d442f4bd6cd 100644
|
||||
--- a/gcc/ada/adaint.h
|
||||
+++ b/gcc/ada/adaint.h
|
||||
@@ -321,13 +321,11 @@ extern void *__gnat_lwp_self (void);
|
||||
|
||||
/* Routines for interface to required CPU set primitives */
|
||||
|
||||
-#include <sched.h>
|
||||
-
|
||||
-extern cpu_set_t *__gnat_cpu_alloc (size_t);
|
||||
+extern void * __gnat_cpu_alloc (size_t);
|
||||
extern size_t __gnat_cpu_alloc_size (size_t);
|
||||
-extern void __gnat_cpu_free (cpu_set_t *);
|
||||
-extern void __gnat_cpu_zero (size_t, cpu_set_t *);
|
||||
-extern void __gnat_cpu_set (int, size_t, cpu_set_t *);
|
||||
+extern void __gnat_cpu_free (void *);
|
||||
+extern void __gnat_cpu_zero (size_t, void *);
|
||||
+extern void __gnat_cpu_set (int, size_t, void *);
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32)
|
||||
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
|
||||
index 32d30a49c7e..d960e32e2d0 100644
|
||||
--- a/gcc/ada/terminals.c
|
||||
+++ b/gcc/ada/terminals.c
|
||||
@@ -1132,7 +1132,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
|
||||
/* POSIX does not specify how to open the master side of a terminal.Several
|
||||
methods are available (system specific):
|
||||
1- using a cloning device (USE_CLONE_DEVICE)
|
||||
- 2- getpt (USE_GETPT)
|
||||
+ 2- posix_openpt (USE_POSIX_OPENPT)
|
||||
3- openpty (USE_OPENPTY)
|
||||
|
||||
When using the cloning device method, the macro USE_CLONE_DEVICE should
|
||||
@@ -1146,7 +1146,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
|
||||
#if defined (__APPLE__) || defined (BSD)
|
||||
#define USE_OPENPTY
|
||||
#elif defined (__linux__)
|
||||
-#define USE_GETPT
|
||||
+#define USE_POSIX_OPENPT
|
||||
#elif defined (__sun__)
|
||||
#define USE_CLONE_DEVICE "/dev/ptmx"
|
||||
#elif defined (_AIX)
|
||||
@@ -1195,8 +1195,8 @@ allocate_pty_desc (pty_desc **desc) {
|
||||
int master_fd = -1;
|
||||
char *slave_name = NULL;
|
||||
|
||||
-#ifdef USE_GETPT
|
||||
- master_fd = getpt ();
|
||||
+#if defined(USE_POSIX_OPENPT)
|
||||
+ master_fd = posix_openpt(O_RDWR | O_NOCTTY);
|
||||
#elif defined (USE_OPENPTY)
|
||||
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
|
||||
#elif defined (USE_CLONE_DEVICE)
|
||||
@@ -0,0 +1,101 @@
|
||||
From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Mon, 19 Dec 2022 10:37:06 -0800
|
||||
Subject: [PATCH] libgo: check for makecontext in -lucontext
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Patch from Sören Tempel.
|
||||
|
||||
Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
libgo/configure.ac | 3 +++
|
||||
2 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/libgo/configure b/libgo/configure
|
||||
index 460fdad7..a607dbff 100755
|
||||
--- a/libgo/configure
|
||||
+++ b/libgo/configure
|
||||
@@ -14818,6 +14818,63 @@ fi
|
||||
|
||||
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5
|
||||
+$as_echo_n "checking for library containing makecontext... " >&6; }
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char makecontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return makecontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_makecontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_makecontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_makecontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_makecontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5
|
||||
+$as_echo "$ac_cv_search_makecontext" >&6; }
|
||||
+ac_res=$ac_cv_search_makecontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5
|
||||
$as_echo_n "checking for library containing sched_yield... " >&6; }
|
||||
if ${ac_cv_search_sched_yield+:} false; then :
|
||||
diff --git a/libgo/configure.ac b/libgo/configure.ac
|
||||
index 09554a37..a59aa091 100644
|
||||
--- a/libgo/configure.ac
|
||||
+++ b/libgo/configure.ac
|
||||
@@ -570,6 +570,9 @@ PTHREAD_LIBS=
|
||||
AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
|
||||
+dnl Test if -lucontext is required for makecontext.
|
||||
+AC_SEARCH_LIBS([makecontext], [ucontext])
|
||||
+
|
||||
dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime.
|
||||
AC_SEARCH_LIBS([sched_yield], [rt])
|
||||
AC_SEARCH_LIBS([nanosleep], [rt])
|
||||
@@ -0,0 +1,204 @@
|
||||
From b3840bdcc0eee2a4d099a9af52199944ade7acb9 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Tue, 29 Nov 2022 17:28:44 -0800
|
||||
Subject: [PATCH] syscall, runtime: always call XSI strerror_r
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This does the right thing for either glibc or musl on GNU/Linux.
|
||||
|
||||
Based on patch by Sören Tempel.
|
||||
|
||||
Change-Id: If2969e131f0fae456d58b35d839d8abe191fcc59
|
||||
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
|
||||
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
||||
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
||||
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
|
||||
---
|
||||
libgo/Makefile.am | 1 +
|
||||
libgo/Makefile.in | 6 +++++-
|
||||
libgo/go/syscall/errstr.go | 22 ++++++++-----------
|
||||
libgo/go/syscall/errstr_glibc.go | 33 ----------------------------
|
||||
libgo/runtime/go-strerror.c | 37 ++++++++++++++++++++++++++++++++
|
||||
5 files changed, 52 insertions(+), 47 deletions(-)
|
||||
delete mode 100644 libgo/go/syscall/errstr_glibc.go
|
||||
create mode 100644 libgo/runtime/go-strerror.c
|
||||
|
||||
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
|
||||
index e0a1eec5..df568743 100644
|
||||
--- a/libgo/Makefile.am
|
||||
+++ b/libgo/Makefile.am
|
||||
@@ -465,6 +465,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
|
||||
index 7bef5df9..f2f3f0fc 100644
|
||||
--- a/libgo/Makefile.in
|
||||
+++ b/libgo/Makefile.in
|
||||
@@ -247,7 +247,7 @@ am__objects_4 = runtime/aeshash.lo runtime/go-assert.lo \
|
||||
runtime/go-fieldtrack.lo runtime/go-matherr.lo \
|
||||
runtime/go-memclr.lo runtime/go-memmove.lo \
|
||||
runtime/go-memequal.lo runtime/go-nanotime.lo \
|
||||
- runtime/go-now.lo runtime/go-nosys.lo \
|
||||
+ runtime/go-now.lo runtime/go-nosys.lo runtime/go-strerror.lo \
|
||||
runtime/go-reflect-call.lo runtime/go-setenv.lo \
|
||||
runtime/go-signal.lo runtime/go-unsafe-pointer.lo \
|
||||
runtime/go-unsetenv.lo runtime/go-unwind.lo \
|
||||
@@ -917,6 +917,7 @@ runtime_files = \
|
||||
runtime/go-nanotime.c \
|
||||
runtime/go-now.c \
|
||||
runtime/go-nosys.c \
|
||||
+ runtime/go-strerror.c \
|
||||
runtime/go-reflect-call.c \
|
||||
runtime/go-setenv.c \
|
||||
runtime/go-signal.c \
|
||||
@@ -1390,6 +1391,8 @@ runtime/go-now.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-nosys.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
+runtime/go-strerror.lo: runtime/$(am__dirstamp) \
|
||||
+ runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-reflect-call.lo: runtime/$(am__dirstamp) \
|
||||
runtime/$(DEPDIR)/$(am__dirstamp)
|
||||
runtime/go-setenv.lo: runtime/$(am__dirstamp) \
|
||||
@@ -1457,6 +1460,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-reflect-call.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-setenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-signal.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-strerror.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unsetenv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/go-unwind.Plo@am__quote@
|
||||
diff --git a/libgo/go/syscall/errstr.go b/libgo/go/syscall/errstr.go
|
||||
index 6c2441d3..9f688e2a 100644
|
||||
--- a/libgo/go/syscall/errstr.go
|
||||
+++ b/libgo/go/syscall/errstr.go
|
||||
@@ -4,23 +4,19 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
-// +build !hurd
|
||||
-// +build !linux
|
||||
-
|
||||
package syscall
|
||||
|
||||
-//sysnb strerror_r(errnum int, buf []byte) (err Errno)
|
||||
-//strerror_r(errnum _C_int, buf *byte, buflen Size_t) _C_int
|
||||
+import "internal/bytealg"
|
||||
+
|
||||
+//extern go_strerror
|
||||
+func go_strerror(_C_int, *byte, Size_t) _C_int
|
||||
|
||||
func Errstr(errnum int) string {
|
||||
- for len := 128; ; len *= 2 {
|
||||
- b := make([]byte, len)
|
||||
- errno := strerror_r(errnum, b)
|
||||
+ for size := 128; ; size *= 2 {
|
||||
+ b := make([]byte, size)
|
||||
+ errno := go_strerror(_C_int(errnum), &b[0], Size_t(len(b)))
|
||||
if errno == 0 {
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
+ i := bytealg.IndexByte(b, 0)
|
||||
// Lowercase first letter: Bad -> bad, but
|
||||
// STREAM -> STREAM.
|
||||
if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
@@ -29,7 +25,7 @@ func Errstr(errnum int) string {
|
||||
return string(b[:i])
|
||||
}
|
||||
if errno != ERANGE {
|
||||
- return "errstr failure"
|
||||
+ return "strerror_r failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/libgo/go/syscall/errstr_glibc.go b/libgo/go/syscall/errstr_glibc.go
|
||||
deleted file mode 100644
|
||||
index 5b19e6f2..00000000
|
||||
--- a/libgo/go/syscall/errstr_glibc.go
|
||||
+++ /dev/null
|
||||
@@ -1,33 +0,0 @@
|
||||
-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
|
||||
-
|
||||
-// Copyright 2010 The Go Authors. All rights reserved.
|
||||
-// Use of this source code is governed by a BSD-style
|
||||
-// license that can be found in the LICENSE file.
|
||||
-
|
||||
-// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||
-// returns a pointer to the error message, and may not use buf at all.
|
||||
-
|
||||
-// +build hurd linux
|
||||
-
|
||||
-package syscall
|
||||
-
|
||||
-import "unsafe"
|
||||
-
|
||||
-//sysnb strerror_r(errnum int, b []byte) (errstr *byte)
|
||||
-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
|
||||
-
|
||||
-func Errstr(errnum int) string {
|
||||
- a := make([]byte, 128)
|
||||
- p := strerror_r(errnum, a)
|
||||
- b := (*[1000]byte)(unsafe.Pointer(p))
|
||||
- i := 0
|
||||
- for b[i] != 0 {
|
||||
- i++
|
||||
- }
|
||||
- // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||
- if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
||||
- c := b[0] + 'a' - 'A'
|
||||
- return string(c) + string(b[1:i])
|
||||
- }
|
||||
- return string(b[:i])
|
||||
-}
|
||||
diff --git a/libgo/runtime/go-strerror.c b/libgo/runtime/go-strerror.c
|
||||
new file mode 100644
|
||||
index 00000000..13d1d91d
|
||||
--- /dev/null
|
||||
+++ b/libgo/runtime/go-strerror.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* go-strerror.c -- wrapper around XSI-compliant strerror_r.
|
||||
+
|
||||
+ Copyright 2022 The Go Authors. All rights reserved.
|
||||
+ Use of this source code is governed by a BSD-style
|
||||
+ license that can be found in the LICENSE file. */
|
||||
+
|
||||
+/* There are two version of strerror_r on GNU/Linux: a GNU-specific
|
||||
+ and an XSI-compliant version. The former version is only available
|
||||
+ on glibc. Since glibc 2.13, the XSI-compliant version is also
|
||||
+ provided by glibc if _GNU_SOURCE is not defined. Since the
|
||||
+ entirety of gofrontend is compiled with _GNU_SOURCE, this file
|
||||
+ exists to selectively undefine it and provides an alias to the
|
||||
+ XSI-compliant version of strerror_r(3). */
|
||||
+
|
||||
+#ifdef __linux__
|
||||
+
|
||||
+/* Force selection of XSI-compliant strerror_r by glibc. */
|
||||
+#undef XOPEN_SOURCE
|
||||
+#define XOPEN_SOURCE 600
|
||||
+#undef _POSIX_C_SOURCE
|
||||
+#define _POSIX_C_SOURCE 200112L
|
||||
+#undef _GNU_SOURCE
|
||||
+
|
||||
+#endif /* __linux__ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#ifndef HAVE_STRERROR_R
|
||||
+// Provided by go-nosys.c if not provided by libc itself.
|
||||
+extern int strerror_r (int, char *, size_t);
|
||||
+#endif
|
||||
+
|
||||
+int
|
||||
+go_strerror (int errnum, char *buf, size_t buflen)
|
||||
+{
|
||||
+ return strerror_r (errnum, buf, buflen);
|
||||
+}
|
||||
@@ -0,0 +1,263 @@
|
||||
From 573a66e4146c9a65d895af9081a4d3d49cfc9e7a Mon Sep 17 00:00:00 2001
|
||||
From: Drew DeVault <sir@cmpwn.com>
|
||||
Date: Wed, 9 Dec 2020 16:07:26 +0000
|
||||
Subject: [PATCH] configure: Add --enable-autolink-libatomic, use in
|
||||
LINK_GCC_C_SEQUENCE_SPEC [PR81358]
|
||||
|
||||
This fixes issues with RISC-V.
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
gcc/config.in | 6 ++++++
|
||||
gcc/config/gnu-user.h | 12 +++++++++++-
|
||||
gcc/configure | 32 ++++++++++++++++++++++++++++++--
|
||||
gcc/configure.ac | 22 +++++++++++++++++++++-
|
||||
gcc/doc/install.texi | 8 ++++++++
|
||||
gcc/doc/tm.texi | 8 +++++++-
|
||||
gcc/doc/tm.texi.in | 8 +++++++-
|
||||
gcc/gcc.cc | 12 +++++++++++-
|
||||
9 files changed, 102 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index b564ddbf792..a95c7407d16 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -232,6 +232,7 @@ HOST_EXPORTS = \
|
||||
RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
|
||||
READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
|
||||
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
|
||||
+ TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS; \
|
||||
HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
|
||||
GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
|
||||
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
|
||||
diff --git a/gcc/config.in b/gcc/config.in
|
||||
index f0fbf123aa8..af84efc4f9e 100644
|
||||
--- a/gcc/config.in
|
||||
+++ b/gcc/config.in
|
||||
@@ -118,6 +118,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
+/* Define if libatomic should always be linked. */
|
||||
+#ifndef USED_FOR_TARGET
|
||||
+#undef ENABLE_AUTOLINK_LIBATOMIC
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/* Define to 1 to specify that we are using the BID decimal floating point
|
||||
format instead of DPD */
|
||||
#ifndef USED_FOR_TARGET
|
||||
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
|
||||
index 8433e56c3e1..0347f10da8b 100644
|
||||
--- a/gcc/config/gnu-user.h
|
||||
+++ b/gcc/config/gnu-user.h
|
||||
@@ -109,8 +109,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
|
||||
#endif
|
||||
|
||||
+#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC)
|
||||
+# ifdef LD_AS_NEEDED_OPTION
|
||||
+# define LINK_LIBATOMIC_SPEC LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION
|
||||
+# else
|
||||
+# define LINK_LIBATOMIC_SPEC "-latomic"
|
||||
+# endif
|
||||
+#elif !defined(LINK_LIBATOMIC_SPEC)
|
||||
+# define LINK_LIBATOMIC_SPEC ""
|
||||
+#endif
|
||||
+
|
||||
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
|
||||
- "%{static|static-pie:--start-group} %G %{!nolibc:%L} \
|
||||
+ "%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC " %L} \
|
||||
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
|
||||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index 2f6b3265a6c..6dc65bf4ccb 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -981,6 +981,7 @@ with_changes_root_url
|
||||
enable_languages
|
||||
with_multilib_list
|
||||
with_multilib_generator
|
||||
+enable_autolink_libatomic
|
||||
with_zstd
|
||||
with_zstd_include
|
||||
with_zstd_lib
|
||||
@@ -1710,6 +1711,9 @@ Optional Features:
|
||||
--disable-shared don't provide a shared libgcc
|
||||
--disable-gcov don't provide libgcov and related host tools
|
||||
--enable-languages=LIST specify which front-ends to build
|
||||
+ --enable-autolink-libatomic
|
||||
+ enable automatic linking of libatomic (ignored if
|
||||
+ not built)
|
||||
--disable-rpath do not hardcode runtime library paths
|
||||
--enable-sjlj-exceptions
|
||||
arrange to use setjmp/longjmp exception handling
|
||||
@@ -8324,7 +8328,6 @@ else
|
||||
fi
|
||||
|
||||
|
||||
-
|
||||
# Check whether --with-multilib-generator was given.
|
||||
if test "${with_multilib_generator+set}" = set; then :
|
||||
withval=$with_multilib_generator; :
|
||||
@@ -8332,6 +8335,32 @@ else
|
||||
with_multilib_generator=default
|
||||
fi
|
||||
|
||||
+# If libatomic is available, whether it should be linked automatically
|
||||
+# Check whether --enable-autolink-libatomic was given.
|
||||
+if test "${enable_autolink_libatomic+set}" = set; then :
|
||||
+ enableval=$enable_autolink_libatomic;
|
||||
+ case $enable_autolink_libatomic in
|
||||
+ yes | no) ;;
|
||||
+ *) as_fn_error $? "'$enable_autolink_libatomic' is an invalid value for
|
||||
+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'." "$LINENO" 5 ;;
|
||||
+ esac
|
||||
+
|
||||
+else
|
||||
+ enable_autolink_libatomic=''
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+if test x$enable_autolink_libatomic = xyes; then
|
||||
+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then
|
||||
+
|
||||
+$as_echo "#define ENABLE_AUTOLINK_LIBATOMIC 1" >>confdefs.h
|
||||
+
|
||||
+ else
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&5
|
||||
+$as_echo "$as_me: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&2;}
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
|
||||
# -------------------------
|
||||
# Checks for other programs
|
||||
@@ -34296,4 +34325,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
|
||||
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
|
||||
fi
|
||||
|
||||
-
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index e683d3a7a5f..07c81c78336 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -1205,6 +1205,27 @@ AC_ARG_WITH(multilib-generator,
|
||||
:,
|
||||
with_multilib_generator=default)
|
||||
|
||||
+# If libatomic is available, whether it should be linked automatically
|
||||
+AC_ARG_ENABLE(autolink-libatomic,
|
||||
+[AS_HELP_STRING([--enable-autolink-libatomic],
|
||||
+ [enable automatic linking of libatomic (ignored if not built)])],
|
||||
+[
|
||||
+ case $enable_autolink_libatomic in
|
||||
+ yes | no) ;;
|
||||
+ *) AC_MSG_ERROR(['$enable_autolink_libatomic' is an invalid value for
|
||||
+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'.]) ;;
|
||||
+ esac
|
||||
+], [enable_autolink_libatomic=''])
|
||||
+
|
||||
+if test x$enable_autolink_libatomic = xyes; then
|
||||
+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then
|
||||
+ AC_DEFINE(ENABLE_AUTOLINK_LIBATOMIC, 1,
|
||||
+ [Define if libatomic should always be linked.])
|
||||
+ else
|
||||
+ AC_MSG_WARN([libatomic is not build for this target, --enable-autolink-libatomic ignored])
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
# -------------------------
|
||||
# Checks for other programs
|
||||
# -------------------------
|
||||
@@ -7839,4 +7860,3 @@ done
|
||||
],
|
||||
[subdirs='$subdirs'])
|
||||
AC_OUTPUT
|
||||
-
|
||||
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
|
||||
index 48408d842db..c90be0ee750 100644
|
||||
--- a/gcc/doc/install.texi
|
||||
+++ b/gcc/doc/install.texi
|
||||
@@ -2295,6 +2295,14 @@ files, but these changed header paths may conflict with some compilation
|
||||
environments. Enabled by default, and may be disabled using
|
||||
@option{--disable-canonical-system-headers}.
|
||||
|
||||
+@item --enable-autolink-libatomic
|
||||
+@itemx --disable-autolink-libatomic
|
||||
+Tell GCC that it should automatically link libatomic; if supported by
|
||||
+the linker, the file is only linked as needed. This flag is ignored
|
||||
+when libatomic is not built. Note that this conigure flag is in particular
|
||||
+useful when building an offloading-target compiler; as for those, a
|
||||
+user had to specify @code{-foffload=target=-latomic} otherwise.
|
||||
+
|
||||
@item --with-glibc-version=@var{major}.@var{minor}
|
||||
Tell GCC that when the GNU C Library (glibc) is used on the target it
|
||||
will be version @var{major}.@var{minor} or later. Normally this can
|
||||
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
|
||||
index c5006afc00d..56b62c69ae8 100644
|
||||
--- a/gcc/doc/tm.texi
|
||||
+++ b/gcc/doc/tm.texi
|
||||
@@ -381,7 +381,13 @@ the argument @option{-lgcc} to tell the linker to do the search.
|
||||
|
||||
@defmac LINK_GCC_C_SEQUENCE_SPEC
|
||||
The sequence in which libgcc and libc are specified to the linker.
|
||||
-By default this is @code{%G %L %G}.
|
||||
+By default this is @code{%G LINK_LIBATOMIC_SPEC %L %G}.
|
||||
+@end defmac
|
||||
+
|
||||
+@defmac LINK_LIBATOMIC_SPEC
|
||||
+This macro is used in the default @code{LINK_GCC_C_SEQUENCE_SPEC} to link
|
||||
+libatomic. By default, it is unset unless @code{ENABLE_AUTOLINK_LIBATOMIC}
|
||||
+is set.
|
||||
@end defmac
|
||||
|
||||
@defmac POST_LINK_SPEC
|
||||
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
|
||||
index f869ddd5e5b..57c93f24ac3 100644
|
||||
--- a/gcc/doc/tm.texi.in
|
||||
+++ b/gcc/doc/tm.texi.in
|
||||
@@ -381,7 +381,13 @@ the argument @option{-lgcc} to tell the linker to do the search.
|
||||
|
||||
@defmac LINK_GCC_C_SEQUENCE_SPEC
|
||||
The sequence in which libgcc and libc are specified to the linker.
|
||||
-By default this is @code{%G %L %G}.
|
||||
+By default this is @code{%G LINK_LIBATOMIC_SPEC %L %G}.
|
||||
+@end defmac
|
||||
+
|
||||
+@defmac LINK_LIBATOMIC_SPEC
|
||||
+This macro is used in the default @code{LINK_GCC_C_SEQUENCE_SPEC} to link
|
||||
+libatomic. By default, it is unset unless @code{ENABLE_AUTOLINK_LIBATOMIC}
|
||||
+is set.
|
||||
@end defmac
|
||||
|
||||
@defmac POST_LINK_SPEC
|
||||
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
|
||||
index 735b2b1bba1..f10f3c91aa7 100644
|
||||
--- a/gcc/gcc.cc
|
||||
+++ b/gcc/gcc.cc
|
||||
@@ -987,13 +987,23 @@ proper position among the other output files. */
|
||||
# define ASM_DEBUG_OPTION_SPEC ""
|
||||
#endif
|
||||
|
||||
+#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC)
|
||||
+# ifdef LD_AS_NEEDED_OPTION
|
||||
+# define LINK_LIBATOMIC_SPEC LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION
|
||||
+# else
|
||||
+# define LINK_LIBATOMIC_SPEC "-latomic"
|
||||
+# endif
|
||||
+#elif !defined(LINK_LIBATOMIC_SPEC)
|
||||
+# define LINK_LIBATOMIC_SPEC ""
|
||||
+#endif
|
||||
+
|
||||
/* Here is the spec for running the linker, after compiling all files. */
|
||||
|
||||
/* This is overridable by the target in case they need to specify the
|
||||
-lgcc and -lc order specially, yet not require them to override all
|
||||
of LINK_COMMAND_SPEC. */
|
||||
#ifndef LINK_GCC_C_SEQUENCE_SPEC
|
||||
-#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
|
||||
+#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:" LINK_LIBATOMIC_SPEC " %L %G}"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DEFAULT_SSP
|
||||
Loaded 100 of 791 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user