Compare commits

...
147 Commits
Author SHA1 Message Date
Aelin 29e45f0494 systemd/xorg-server: upgrade to 21.1.23
Ref: https://gitlab.alpinelinux.org/alpine/aports/-/commit/de6c6be6f84f940d340387d620e72da75c18a186
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8724>
(cherry picked from commit dfa76a6744)
2026-06-07 12:58:48 +02:00
Antoine Martin c090a7364d linux-pine64-pinenote: upgrade to 6.18.29
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8557>
2026-05-14 09:36:29 -04:00
adamthiede 850a80a23d linux-postmarketos-mediatek-mt81: upgrade to 6.12.87
patch doesn't apply; examining source looks like it's no longer needed

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8520>
2026-05-09 05:59:54 -05:00
Antoine Martin 14b8d91b92 linux-pine64-pinenote: upgrade to 6.18.25
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8463>
2026-04-30 19:18:08 -04:00
Bart Ribbers 503c7a5542 systemd/kwin: rebuild against Qt 6.10.3
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8454>
2026-04-30 07:56:16 +02:00
Aster Boese 1b6f0e3dc5 systemd/cups: upgrade to 2.4.18
Signed-off-by: Aster Boese <asterboese@mailbox.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8431>
2026-04-26 10:58:19 +02:00
Antoine Martin 3ed472e2fd linux-pine64-pinenote: upgrade to 6.18.22
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8381>
2026-04-17 15:04:05 +00:00
Aelin 3cbaee0c88 systemd/xorg-server: upgrade to 21.1.22
Ref: https://gitlab.alpinelinux.org/alpine/aports/-/commit/3d6fde66df26d446f5628cf91bc06fd3fdc5fdfe
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8382>
2026-04-17 13:35:11 +02:00
Oliver Smith c9edeac605 cross/musl-*: upgrade to 1.2.5-r23
Signed-off-by: Oliver Smith <ollieparanoid@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8333>
2026-04-12 12:42:45 +02:00
Antoine Martin dba5621afb device-pine64-pinenote: implement rockchip_ebc reload workaround on openrc
Implements openrc implementation of the workaround introduced in
d7229de9d4 for a `rockchip_ebc` bug where the
initial waveform is not properly loaded. Reloading `rockchip_ebc` just
before starting `tinydm` loads the correct waveform.

In systemd, this is implemented via a systemd override file for
`tinydm.service` that includes an `ExecStartPre`, reloading the driver via
modprobe. For openrc, we add an initd service that restarts driver before
starting `tinydm`.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8273>
2026-04-11 14:34:08 +00:00
Antoine Martin a32e9e3fbb linux-pine64-pinenote: upgrade to 6.18.21
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8291>
2026-04-06 23:00:46 -04:00
Oliver Smith b032072a31 main/mobile-config-firefox: upgrade to 5.2.0
Backport of:
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/100032

Signed-off-by: Oliver Smith <ollieparanoid@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8270>
2026-04-03 16:58:50 +02:00
Bart Ribbers 00ac404b11 systemd/plasma*: upgrade to 6.5.6
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8205>
2026-03-23 18:24:12 +01:00
Bart Ribbers ee7f643145 ci: add deviceinfo_schema.toml to fix dint linting
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8205>
2026-03-20 08:48:26 +01:00
Bart Ribbers dd8a81286e ci: update references from 'master' branch to 'main'
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8205>
2026-03-20 08:45:12 +01:00
Antoine Martin e4512a5e50 linux-pine64-pinenote: upgrade to 6.18.16
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8150>
2026-03-09 13:00:02 -04:00
Antoine Martin f72142e425 linux-pine64-pinenote: upgrade to 6.18.15
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8107>
2026-03-08 00:09:01 +00:00
Oliver Smith ad915bbab5 systemd/networkmanager: upgrade to 1.52.2
Signed-off-by: Oliver Smith <ollieparanoid@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8024>
(cherry picked from commit de0624fb53)
2026-03-02 22:19:17 +01:00
Antoine Martin 3a57149f5e linux-pine64-pinenote: upgrade to 6.18.13
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8053>
2026-02-27 13:58:48 +00:00
Oliver Smith 0e5f680f5c systemd/mutter: upgrade to 49.4
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8058>
2026-02-22 15:52:30 +01:00
Oliver Smith ec8c7d6667 systemd/gnome-shell: upgrade to 49.4
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8058>
2026-02-22 15:51:50 +01:00
Oliver Smith acb3c0acbf systemd/gnome-desktop: upgrade to 44.5
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8058>
2026-02-22 15:51:06 +01:00
Antoine Martin 377095da9a linux-pine64-pinenote: upgrade to 6.18.10
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8016>
2026-02-18 19:26:15 +00:00
Richard Acayan 094980ad8a linux-postmarketos-qcom-sdm670: backport q6asm-dai sound fix
(cherry picked from commit 10462ab8a7)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7930>
2026-02-17 20:46:50 +00:00
Richard Acayan a34e2e2476 linux-postmarketos-qcom-sdm670: upgrade to v6.18.5
(cherry picked from commit b953dc5d29)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7930>
2026-02-17 20:46:50 +00:00
Sebastian Fleer b305164914 linux-postmarketos-rockchip: upgrade to 6.18.8
and resolve all kconfigcheck warnings.

(cherry picked from commit 1251bfe781)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7892>
2026-02-11 01:32:43 +00:00
Clayton Craft 8d9a8b8d3f main/postmarketos-base: switch to pmos-zram
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 8b4f66950c)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7925>
2026-02-06 08:06:05 -08:00
Clayton Craft cfbf9ccf13 systemd/postmarketos-base-systemd: add preset for zram-swap
And remove preset for zram-init's zram_swap

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 2b4650d9f3)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7925>
2026-02-06 08:06:05 -08:00
Clayton Craft ffb0d17160 main/postmarketos-zram: increase default zram factor/size to 150%
This "size"/factor/percentage represents the total amount of
**uncompressed** data that is allowed to be written to the zram-backed
swap device. It is **not** the amount of RAM to use for zram swap (as I
had previously and erroneously thought.) What this means is that if we
set the percent to 50% on a device with 3GB of RAM then up to 1.5GB of
*uncompressed* data can be written to it, BUT since compression algos
usually do better than a ratio of 1:1... less than 1.5GB of RAM will
actually be occupied by this data when it is compressed.

A 1.5:1 compression ratio seems relatively safe to assume, even if we
use lz4 (which is less "good" at compressing than zstd), so I propose we
set the size to 150%. Some distros (PureOS) set this higher (200%), but
I think we should be somewhat conservative since we want to avoid any
thrashing in case the compression ratio at runtime ends up being less
than 2:1 for some reason.

This does set a limit of 50% for devices with >32GB of RAM, to
reduce overhead with using a larger amount of zram swap. The kernel
documentation for zram suggests there's a 0.1% overhead, so if we let
this amount get large then it could be tens or hundreds of MB of RAM
"wasted." The amount I chose is kinda arbitrary, I think this can be
improved later. At the very least, users can change this amount in the
deviceinfo variable.

Fixes #4250

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 49b9e02ddf)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7925>
2026-02-06 08:06:05 -08:00
Clayton Craft 218cb21297 main/postmarketos-zram: new aport
This is meant to replace zram-init. It's much simpler, since it only
sets up zram swap and doesn't try to do all the things that zram-init
does. This also lets us add additional logic, such as selecting
different default algorithms based on the runtime CPU arch and
conditionally applying sysctl settings that might be inappropriate when
*not* using zram swap.

To create zramstart, I took the zram-configurator, which reads config
from deviceinfo vars, and extended it to create the zram swap device.

zramstart and zramstop were inspired by what Fedora does. The sysctl
config is from the work done here:
https://source.puri.sm/Librem5/librem5-base/-/merge_requests/381

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 7aee3f6f58)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7925>
2026-02-06 08:06:01 -08:00
Bart Ribbers 9bfad67f75 systemd/plasma*: upgrade to 6.5.5
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7933>
2026-02-06 01:16:33 +00:00
Clayton Craft efa0ae3674 main/postmarketos-base-ui: add ModemManager config override
We used to use this param when the MM systemd unit was vendored in
pmaports but it was dropped when we switched to the upstream unit. This
also sets the param in openrc installs.

Fixes #4194

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 84cac35407)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7899>
2026-02-05 22:46:47 +00:00
Clayton Craft 4aca668f8d soc-qcom: remove MM config
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 920c4a8478)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7899>
2026-02-05 22:46:47 +00:00
Clayton Craft e24641907e device-purism-librem5: remove MM config
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit a042b2080d)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7899>
2026-02-05 22:46:47 +00:00
Clayton Craft 74e9eece3d device-pine64-pinephonepro: remove MM config
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit ab80136a3e)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7899>
2026-02-05 22:46:47 +00:00
Clayton Craft 0b5291bf55 device-pine64-pinephone: remove MM config
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 6975af2fe9)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7899>
2026-02-05 22:46:47 +00:00
Bart Ribbers afd012a2c5 systemd/networkmanager: downgrade to 1.52.1
The 1.54 release broke hotspot (#4118), and downgrading back to 1.52.1
seems to solve the issue. This regression also got in stable sadly.

[ci:skip-vercheck] We're downgrading, a lower pkgver is expected

(cherry picked from commit 824d05104558b1b6c94d493c83cf7d4c32351803)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7931>
2026-02-04 22:50:40 +01:00
Clayton Craft dd00426ae9 systemd/pmos-base-systemd: update preset for pipewire/pipewire-pulse
With a recent aports patch[1], unit files are now in aports, however
socket activation is not enabled since that depends on libsystemd.
Instead, we'll just start the units on user session start. I think most
UIs/devices are going to want audio fairly early and often, so I think
it's fine to just start this stuff and is a reasonable price to pay for
being able to avoid having a package fork of pipewire in pmaports.

1. https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/96828

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7904>
2026-02-02 10:36:37 -08:00
Clayton Craft 0c2d062d7f systemd/pipewire: drop aport
Unit files were added to the upstream aports pkg.

pw and pw-pulse are no longer socket activated with this change, because
that requires linking against libsystemd(which isn't enabled upstream),
but I think that's worth avoiding all of the packaging complexity of
having a pipewire pkg fork in pmaports.

Fixes #4279

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7904>
2026-02-02 10:36:37 -08:00
Achill Gilgenast d09d3c0449 main/postmarketos-release-upgrade-notification: new aport
Previously the process was that once a branch is EOL, the
notification-commit was cherry-picked from the branch before.

However that makes less sense, since the package then doesn't go
through the same mass updates as pmaports master does, e.g. it still
referenced gitlab.com & -gtk3, and doesn't allow changes by contributors
other than the one cherry-picking it.

Adapted from c088d806ea ("main/postmarketos-upgrade-gtk3: new aport")

See https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/4197.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7769>
(cherry picked from commit 7f8facc9d8)
2026-01-27 16:28:13 +01:00
Aelin d8450360c1 systemd/cups: upgrade to 2.4.16
(cherry picked from commit 778f31eed5)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7856>
2026-01-27 06:26:32 +01:00
Clayton Craft 5b58d10224 systemd/postmarketos-base-systemd: add systemd-time-wait-sync preset
This unit will activate `time-sync.target` after system time is synced,
e.g. by NTP. We can use this target to delay starting some units until
we know that system time is correct. IIUC this shouldn't have any impact
on system startup otherwise, including existing units we enable, so
nothing should be slowed down by adding this.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 5e435f9669)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7730>
2026-01-22 13:26:05 -08:00
Clayton Craft 30bba86ef6 main/postmarketos-base-ui: delay starting flatpak helper
This is a workaround for https://github.com/flatpak/flatpak/issues/6449

By requiring that system time is sync'd with NTP before the flatpak
helper is started, we can make sure that system time is always greater
than the flathub.org repo gpg key creation time, and prevent the
helper/flatpak from creating broken repo config that requires manual
intervention to fix.

Fixes #3816

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 96d714f167)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7730>
2026-01-22 13:26:04 -08:00
WeirdTreeThing 4f228e8306 modem/msm-cros-efs-loader: upgrade to 1.2.1
Closes https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/4273

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7567>
(cherry picked from commit 750a5e44c6)
2026-01-22 09:55:40 +01:00
Aster Boese c65caf06de systemd/pipewire: fix pipewire-pulse install_if
Finishes https://gitlab.postmarketos.org/postmarketOS/pmaports/-/commit/25bb4d4ea1f94accbf35110b4a9ea21dcad8fa49

Signed-off-by: Aster Boese <asterboese@mailbox.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7783>
2026-01-21 08:24:42 -08:00
Achill Gilgenast f03c565af9 device/*: update pmos-base-ui-backend-audio-* dependency pkg names
Equivalent of 1ca5a1ad58 ("device/*: update pmos-base-ui-backend-audio-* dependency pkg names")

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7783>
2026-01-21 08:24:42 -08:00
Achill Gilgenast 8c69d6e8bb systemd/pipewire: lower preferance to install pipewire-pulse than pulseaudio
For some reason, apk preferred to satisfy g-s-d's pulseaudio dependency
by pipewire-pulse-9991.4.9-r1 (with k=1) and not pulseaudio-17.0-r7
(with k=10), and therefore didn't respect provider_priority but pkgver.

This then resulted in the apk solver preferring
pmos-base-ui-audio-pipewire over -pulseaudio, because the
!pipewire-pulse dep by -pulseaudio wasn't satisfiable.

[ci:skip-build]: alpine binary repos incomplete for some archs

(cherry picked from commit 25bb4d4ea1)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7783>
2026-01-21 08:24:42 -08:00
Clayton Craft 933da6c56e main/postmarketos-base-ui: set defaults for pmb_select
This should fix cases where pw-pulse was being installed by default by
pmbootstrap despite not being selected.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 3c2af74036)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7783>
2026-01-21 08:24:29 -08:00
Aster Boese dadfd10fa9 systemd/pipewire: downgrade to 1.4.9
Related to https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/890

Signed-off-by: Aster Boese <asterboese@mailbox.org>

[ci:skip-vercheck]

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7794>
2026-01-18 22:37:30 -05:00
Clayton Craft c3ef9c0588 device-google-x64cros: add emmc/sdhci module for chromebook emmc
Some chromebooks (swanky) need this module when using mrchromebox fw for
emmc to work in the initramfs

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7792>
(cherry picked from commit c2c979c44a)
2026-01-18 16:58:20 -08:00
Achill Gilgenast de1ba4129d systemd/pipewire: upgrade to 1.4.10
(cherry picked from commit 4cd0f4ac5c)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7779>
2026-01-17 13:17:46 +01:00
Antoine Martin 820d9f1efa device-pine64-pinenote: drop pinenote-dbus-service depend
pinenote-dbus-service package does not exist anymore

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7728>
2026-01-16 13:49:25 +00:00
Antoine Martin 66859f3b00 pinenote-dbus-service: remove due to incompatibility with current kernel
(cherry picked from commit d5ae5740f8)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7728>
2026-01-16 13:49:25 +00:00
Antoine Martin 1475b62831 {linux,device,u-boot}-pine64-pinenote: move to community from testing
[ci:skip-vercheck]

(cherry picked from commit ec4c1d9bfd)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7728>
2026-01-16 13:49:25 +00:00
Clayton Craft 10861f91a5 device-google-sargo: remove modem-gnss from openrc post-install
This was moved to soc-qcom in 8d356e5056

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit b9e6ca1211)
[ci:skip-vercheck]

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7646>
2026-01-15 23:44:33 -08:00
Aster Boese 38b01c24c9 soc-qcom: install modem-gnss openrc service with executable permissions
Fixes service being installed 644 by 8d356e5056

Signed-off-by: Aster Boese <asterboese@mailbox.org>
(cherry picked from commit a859221da5)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7646>
2026-01-15 23:44:33 -08:00
Clayton Craft 7af5b6fd26 soc-qcom: delay starting modem-gnss on boot
modem-gnss / qmicli depends on qrtr being up, or it fails on boot and
GPS doesn't work on this device:

 sargo systemd[1]: Starting Google Sargo (Pixel 3a) GNSS Modem Setup...
 sargo qmicli[1080]: error: node with id 0 not found in QRTR bus

Ideally there would be a path in /dev or sysfs so we could add a
ConditionPathExists= in the unit, but I tried hard to find something and
was unable to. Making modem-gnss depend on ModemManager seems to work
around this issue, since qrtr seems to always (in my testing) be up by
then. IIUC in the future we may not have to run qmicli to enable GPS, so
this patch is a workaround to fix a workaround.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 57c75db149)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7646>
2026-01-15 23:44:33 -08:00
Clayton Craft 18d0f4d67b community/soc-qcom: move modem-gnss service from google-sargo
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 8d356e5056)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7646>
2026-01-15 23:44:33 -08:00
Clayton Craft 414925cdeb temp/iio-sensor-proxy: add patch to fix inverted rotation on sargo
The previous rule is too vague and would also tag /dev/fastrpc-cdsp
devices too. Sometimes iio-sensor-proxy would bind to this which
seemed to always produce inverted orientation values. If only
/dev/fastrpc-adsp* is tagged, then orientation always seems to be
correct.

fixes #3741

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 481c2a8970)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7698>
2026-01-15 23:40:48 -08:00
Clayton Craft 9248f65568 modem/rmtfs: Fix path in openrc init script
Fixes 667729a4e1

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7772>
2026-01-15 13:59:49 -08:00
Antoine Martin c85f99bcc4 linux-pine64-pinenote: upgrade to 6.18.5
(cherry picked from commit 010ba0b0d5)

Co-authored-by: Antoine Martin <dev@ayakael.net>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7744>
2026-01-13 20:04:40 +00:00
Sebastian Fleer 32128a3688 linux-postmarketos-rockchip: upgrade to 6.18.5
and set CONFIG_USB_CONFIGFS_F_FS=y according to kconfigcheck.toml

(cherry picked from commit 98affd740b3cefc249aa7d41ef57af3a137b6ffb)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7741>
2026-01-13 09:00:41 +01:00
Achill Gilgenast 0bb40e53ca systemd/systemd-services: remove hexagonrpcd-systemd
Services upstream in hexagonrpcd and backported in Alpine upstream,
override in HEAD~.

(cherry picked from commit 15d376dbe7)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7727>
2026-01-12 11:18:37 -08:00
Clayton Craft 4efb5482b8 modem/msm-modem: add systemd override for rmtfs.service
To make systemd start it before msm-modem-uim-selection. The upstream
rmtfs unit doesn't include this, so we package it here as an override.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit db35abcce4)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7727>
2026-01-12 11:18:37 -08:00
Achill Gilgenast 3917ea5cd1 systemd/systemd-services: remove rmtfs.service
(cherry picked from commit 7b6fe18469)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7727>
2026-01-12 11:18:09 -08:00
Achill Gilgenast e399265797 modem/rmtfs: split -udev
(cherry picked from commit c3872e764e)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7727>
2026-01-12 11:18:09 -08:00
Achill Gilgenast 667729a4e1 modem/rmtfs: subpackage -systemd
(cherry picked from commit f7052461da)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7727>
2026-01-12 11:18:09 -08:00
Achill Gilgenast dc2dda2a45 temp/iio-sensor-proxy: start hexagonrpcd before in systemd
Moved from systemd-services, our iio-sensor-proxy are the ones depending
on hexagonrpcd being started before because of the libssc patches.

(cherry picked from commit bb63df7fca)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7727>
2026-01-12 11:18:09 -08:00
Antoine Martin ea8fc266e5 linux-pine64-pinenote: upgrade to 6.18.4
(cherry picked from commit c1b5c32f18)

Co-authored-by: Antoine Martin <dev@ayakael.net>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7719>
2026-01-11 08:06:31 -05:00
Clayton Craft 3af8091044 temp/iio-sensor-proxy: rebuild against libssc 0.3
Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
(cherry picked from commit 076b3f343d)

Signed-off-by: Aster Boese <asterboese@mailbox.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7694>
2026-01-05 09:31:52 -05:00
Antoine Martin 7921909a9f linux-pine64-pinenote: upgrade to 6.18.3
(cherry picked from commit 4d713c7133)

Co-authored-by: Antoine Martin <dev@ayakael.net>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7689>
2026-01-03 14:48:12 -05:00
Clayton Craft 9c47fa36d6 modem/msm-modem: do not return non-zero if no SIM is detected
MM does other important things (like enable GPS) even if no SIM is
installed, but when this returns non-zero after timing out waiting for a
SIM then we lose the ability to have MM enable GPS (for example). Other
failures related to selecting SIMs should still trigger a non-zero exit
and block MM (I guess), but if we waited a while and no SIM shows up
then let MM start anyways.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7634>
(cherry picked from commit 5fe98f2476)
2026-01-01 12:32:51 -08:00
Sebastian Fleer 935594eb90 linux-postmarketos-rockchip: upgrade to 6.18.2
and add NTSYNC module according to kconfigcheck

(cherry picked from commit b1f4684fa9)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7667>
2025-12-30 09:50:38 +01:00
Stefan Hansson cb91fc2468 CI: Set args.ccache in conftest.py
Fixes CI being broken everywhere:

      File "/builds/postmarketOS/pmaports/.ci/testcases/conftest.py", line 32, in args
        init_args(args)
      File "/tmp/pmbootstrap/pmb/helpers/args.py", line 94, in init
        context.ccache = args.ccache
                     ^^^^^^^^^^^
    AttributeError: 'PmbArgs' object has no attribute 'ccache'

Signed-off-by: Stefan Hansson <newbyte@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7670>
(cherry picked from commit a652a6f334)
2025-12-30 09:49:09 +01:00
Achill Gilgenast 4e402b34a2 systemd/wireplumber: upgrade to 0.5.13
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7638>
(cherry picked from commit bb1f8cb515)
2025-12-29 14:12:22 +01:00
Antoine Martin 4be8d002a0 device-pine64-pinenote: set tinydm to sway only if hrdl is enabled, but not installed
`device-pine64-pinenote-sway.post-upgrade` should check if `sway_hrdl`
is enabled but not installed (like in the case of upgrading from v7-r0
to v8-r0) before setting default session back to `sway`. Else, every
upgrade will set the session back to sway.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7645>
2025-12-27 00:13:13 +00:00
Antoine Martin 3306739dd4 device-pine64-pinenote: fix chroot install
`device-pine64-pinenote-systemd.post-install` checks if `tinydm-ebc` was
active via `is-active` systemctl command. This does not work in chroot
environment, and exits with exit code 0, thus acting as if `tinydm-ebc`
is active. Since this check is used for v7-r0 to v8-r0 upgrade, it can
be assumed that if output isn't `active`, then the check should not
pass. This commit reworks this by looking for that output rather than a
zero exit code.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7645>
2025-12-27 00:13:13 +00:00
Antoine Martin 1cf914debe linux-pine64-pinenote: set CONFIG_NLS_ASCII=y
Boot partition, when set as fat32, expects ASCII charset.

(cherry picked from commit 2c08601858)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7637>
2025-12-26 14:40:52 -05:00
Antoine Martin 395e9dc58b linux-pine64-pinenote: upgrade to 6.18.2
(cherry picked from commit 9107b52a31)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7637>
2025-12-26 14:40:42 -05:00
Oliver Smith e77b5cb2ac main/postmarketos-release-upgrade: upgrade to 1.11.1
Related: https://gitlab.postmarketos.org/postmarketOS/postmarketos-release-upgrade/-/tags/1.11.1
(cherry picked from commit 685f12950a81a7bf7b2ad6627c24a4ef345c23d3)
2025-12-23 16:07:07 +01:00
Oliver Smith 1024f1e624 systemd/plasma-workspace: upgrade to 6.5.4
Related: https://gitlab.alpinelinux.org/alpine/aports/-/commit/4e027d6b1de5156c22c1bfa15b6bf13f82f1b525
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7628>
2025-12-23 08:40:38 +01:00
Oliver Smith f8e602a466 systemd/kwin: upgrade to 6.5.4
Related: https://gitlab.alpinelinux.org/alpine/aports/-/commit/4e027d6b1de5156c22c1bfa15b6bf13f82f1b525
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7628>
2025-12-23 08:40:38 +01:00
Oliver Smith 04789a1117 systemd/kscreenlocker: upgrade to 6.5.4
Related: https://gitlab.alpinelinux.org/alpine/aports/-/commit/4e027d6b1de5156c22c1bfa15b6bf13f82f1b525
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7628>
2025-12-23 08:40:38 +01:00
Oliver Smith b0adede19b CI: adjust supported arches for stable
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7628>
2025-12-23 08:40:38 +01:00
Oliver Smith 616b5afe8c main/mobile-config-firefox: upgrade to 5.1.0
Backport of:
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/94983
2025-12-22 09:46:11 +01:00
Oliver Smith fe17077d53 device-purism-librem5: disable pipewire
Calls are broken for the Librem 5 with pipewire. Switch to pulseaudio
again until this is resolved by depending on
postmarketosbase-ui-audio-pulseaudio and pulseaudio<9990. The later is
needed as otherwise we get a conflict with pipewire-pulse:

  ERROR: unable to select packages:
    pipewire-pulse-9991.4.9-r1:
      breaks: postmarketos-base-ui-audio-pulseaudio-42-r0[!pipewire-pulse]
      satisfies: device-purism-librem5-9-r6[pulseaudio>17]
                 gnome-settings-daemon-99948.1-r3[pulseaudio]
                 postmarketos-base-ui-audio-pulseaudio-42-r0[pulseaudio]

That pulseaudio<9990 is needed is not great, but doing it like this
inside the device package is the best way to ensure this doesn't affect
any other devices for now, with the intention to have this change
backported to v25.12 before we announce the release. I've created issue
4187 to discuss how to improve the pulseaudio/pipewire packaging in
general so this isn't necessary in the future.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7619>
(cherry picked from commit 613c20c7e7)
2025-12-22 08:32:37 +01:00
Achill Gilgenast 6a2a208480 systemd/postmarketos-base-systemd: fix xdg-user-dirs preset
systemd.preset(5) expects the unit suffix which was missing and
resulted in not enabling.

Fixes: bbc4d2c9c7 ("systemd/postmarketos-base-systemd: enable xdg-user-dirs by default")
Ref: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/4169#note_522422
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7611>
(cherry picked from commit 29f27e4b55)
2025-12-21 16:40:15 +01:00
Oliver Smith b4093a6205 main/mobile-config-firefox: fix conflict with librewolf
Fixes: https://gitlab.postmarketos.org/postmarketOS/mobile-config-firefox/-/issues/112
Related: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/94860
2025-12-18 20:26:37 +01:00
Henrik Grimler b075406a66 linux-postmarketos-exynos5: upgrade to 6.12.62
Changes are roughly:

- Rebase on-top of 6.12.62
- Add isa1200 driver (from exynos4), and use it on manta (@lat3st)
- Add camera flash for manta (@lat3st)
- Improve manta audio driver to decrease CPU load (@alexmrqt)
- Fix wacom w9000 pen being always active unless inserted (@eisenbahnfan)
- Drop a pm_domain hack, and instead make exynos5 subcmu driver wait
  for pm_domain to probe first (@eisenbahnfan)

(cherry picked from commit 8cbef98839)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7588>
2025-12-17 23:49:42 +00:00
Eisenbahnfan f4d4f8f834 device-samsung-{n1awifi,n2awifi,v1awifi}: disable gsd-color
Disable gsd-color that uses a whole CPU at 100% doing nothing.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7558>
(cherry picked from commit e88f56d618)
2025-12-17 18:58:00 +01:00
Jens Reidel 3708eb3069 kconfigcheck: Don't require LTO_CLANG_THIN for CFI
This is only required on kernels prior to 6.1 and not even supported on
some architectures like ARMv7.

Signed-off-by: Jens Reidel <adrian@postmarketos.org>
(cherry picked from commit 7d3b8e05df)

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7589>
2025-12-17 18:33:14 +01:00
Bart Ribbers a76ceab4f1 main/postmarketos-ui-plasma-mobile: fix typo in systemd user override
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7478>
(cherry picked from commit 7b9c17483f)
2025-12-15 15:49:01 -08:00
Pablo Correa Gómez a11b08da3f kconfigcheck.toml: add missing "all" arch to category:rust
This makes the whole thing more consistent, and allows to verify
architectures in pmb

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7527>
(cherry picked from commit 6e99b38fc8)
2025-12-15 21:54:55 +01:00
Pablo Correa Gómez fc2fb03240 kconfigcheck.toml: fix architecture typo
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7523>
(cherry picked from commit 7bbac7dea6)
2025-12-15 21:53:08 +01:00
Duje Mihanović cae8877a83 linux-samsung-coreprimevelte: Fix touchscreen
Add a patch increasing the touchscreen voltage to fix some
newly-discovered touchscreen issues.

Signed-off-by: Duje Mihanović <duje@dujemihanovic.xyz>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7577>
(cherry picked from commit 93cc790a9d)
2025-12-15 21:39:56 +01:00
Ferass El Hafidi bbe187d76f device-amlogic-aarch64-tvbox: fix ugoos-am3 build
Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7573>
(cherry picked from commit 9e07e317fb)
2025-12-15 20:44:22 +01:00
Oliver Smith 2ab78bf89f main/mobile-config-firefox: upgrade to 5.0.1
Backport of https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/94701
2025-12-15 20:32:28 +01:00
Clayton Craft a447e88cca systemd/postmarketos-base-systemd: fix user and root slice oomd config
Apparently the user slice and root slice weren't being configured
correctly and oomd was not stepping in during high swap pressure events
before the kernel oom killer showed up to the party. This (hopefully)
properly configures systemd-oomd now... The configuration was inspired
by Fedora.
https://fedoraproject.org/wiki/Changes/EnableSystemdOomd

I used the test in that wiki page to confirm it's now properly configured:

$ systemd-run --user tail /dev/zero
$ journalctl -f
...
systemd[1081]: Started [systemd-run] /usr/bin/tail /dev/zero.
systemd-oomd[517]: Considered 79 cgroups for killing, top candidates were:
systemd-oomd[517]:         Path: /user.slice/user-10000.slice/user@10000.service/app.slice/run-p5146-i5147.service
systemd-oomd[517]:                 Swap Usage: 4.6G
systemd-oomd[517]: Killed /user.slice/user-10000.slice/user@10000.service/app.slice/run-p5146-i5147.service due to memory used (2458>
systemd[1081]: run-p5146-i5147.service: systemd-oomd killed 1 process(es) in this unit.
systemd[1081]: run-p5146-i5147.service: Main process exited, code=killed, status=9/KILL
systemd[1081]: run-p5146-i5147.service: Failed with result 'oom-kill'.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7556>
(cherry picked from commit 1fd1396385)
2025-12-15 20:22:43 +01:00
Antoine Martin dfa99ecbbc systemd/postmarketos-base-systemd: add pinenote systemd units to base preset
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7515>
(cherry picked from commit d34a040357)
2025-12-15 20:21:33 +01:00
Antoine Martin a24f2b56de device-pine64-pinenote: fix waybar icons by being unicode compliant
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7515>
(cherry picked from commit b5256b5f3d)
2025-12-15 20:21:33 +01:00
Antoine Martin ef062e73d9 device-pine64-pinenote: rename sway,sway-systemd subpackage to sway-hrdl, systemd
In an effort to have the option to start with a vanilla sway experience,
the sway subpackage is renamed to sway-hrdl to allow for a vanilla sway
config by default, but give the option for hrdl's opiniated
configuration if desired. Non-opiniated eink optimizations will be added to
the now empty sway subpackage as they are developped. A post-install
script was added to move back to vanilla sway.

In favor of using the more automated systemd subpkg. `tinydm-ebc.service` is
removed in favor of an override file for `tinydm.service` packaged in a
device-wide systemd subpackage. A post-install script was added to
disable `tinydm-ebc.service` and enable `tinydm.service` is tinydm is
in-use at time of upgrade.

Enabling systemd units is now handled by postmarketos-base-systemd's
90-base.preset.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7515>
(cherry picked from commit d7229de9d4)
2025-12-15 20:21:33 +01:00
Antoine Martin 2c48d4140e device-pine64-pinenote: drop phosh subpackage as not needed
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7470>
(cherry picked from commit a948683136)
2025-12-15 20:20:12 +01:00
Antoine Martin 9474e0ee3f linux-pine64-pinenote: upgrade to 6.18.1
Cherry-picked from affdf01c15 and a7cb07b4bc

[ci:skip-kconfigcheck]: Already checked on edge

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7574>
2025-12-15 18:56:33 +00:00
Achill Gilgenast 63570b9947 systemd/networkmanager: upgrade to 1.54.3
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7560>
(cherry picked from commit 72d41b909f)
2025-12-15 19:28:26 +01:00
Achill Gilgenast a9d957416c cross/systemd-boot-x86: upgrade to 258.3
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/94695

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7575>
(cherry picked from commit de51296af2)
2025-12-15 19:27:15 +01:00
Oliver Smith 8fbc0cb214 main/postmarketos-release-upgrade: upgrade to 1.11.0
(cherry picked from commit b1cb0ef5b6cae7ff2789840f023fe14f118cbfe7)
2025-12-14 22:21:29 +01:00
Oliver Smith 94b55482e7 temp/asahi-scripts: fork from Alpine edge 2025-12-14 21:45:12 +01:00
Oliver Smith 2d14c099f3 main/mobile-config-firefox: upgrade to 5.0.0
The packagen now lives upstream in Alpine edge. Backport
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/94669
to pmaports v25.12.
2025-12-14 21:26:31 +01:00
Clayton Craft 068421f7a7 main/postmarketos-initramfs: add crc32c_cryptoapi to default modules list
In some kernels, this may be =m, so we need to include this module so we
can mount BTRFS.

Also see: https://gitlab.alpinelinux.org/alpine/aports/-/issues/17787

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7554>
(cherry picked from commit 5c7d664d88)
2025-12-14 10:16:30 -08:00
Bart Ribbers c3fe930788 purism-librem5: always install wys rather than only for GNOME
All UI's use ModemManager nowadays and without this calling is broken.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7564>
(cherry picked from commit a042ba345b)
2025-12-14 17:21:27 +01:00
Clayton Craft 1b8285a9b1 device-apple-mac-aarch64: drop dependency on asahi-fwextract
This isn't being used in the device port, so we don't need to depend
on it.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7528>
(cherry picked from commit bd75bd2184)
2025-12-10 17:26:58 -08:00
Clayton Craft 5dd6167e59 device-apple-mac-aarch64: re-add to stable branch
This partially reverts commit ddcbf4091e.

The next commit will remove the problematic dependency

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
2025-12-10 17:26:04 -08:00
Oliver Smith 7c8fb13e50 systemd/dbus: rebuild with proper deps
The dbus-dev package in ppc64le does not depend on systemd-dev yet, as
it was not rebuilt after the initial bootstrap of the repository.

See depends here:
* https://pkgs.postmarketos.org/package/master/postmarketos:systemd/ppc64le/dbus-dev
* https://pkgs.postmarketos.org/package/master/postmarketos:systemd/riscv64/dbus-dev

Rebuild it to fix that packages building against dbus-dev fail with:
  Package 'libsystemd', required by 'dbus-1', not found

All arches in v25.12 have the same problem, so this patch will be
backported there. Long-term we will want to fix this properly, but given
that the release is close, this is a good enough workaround with low
risk of breaking anything.

Related: pmaports issue 4156
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7543>
(cherry picked from commit 202f4ce025)
2025-12-10 21:25:38 +01:00
Jens Reidel ae0c07db58 device-qcom-sm7150: Disable splash and serial console for now
On systemd installs, pbsplash causes the device to hang during init and
reset. OpenRC does not exhibit this behavior. Let's disable the splash
screen for now to get the devices working out of the box again and look
into this again after 25.12 when we have plymouth.

The serial getty setup is broken on some devices. Not all of them have
the UART TX/RX connected in hardware, so the ttyMSM0 does not exist on
all devices. On those that have it, it works, on those that don't, it
causes logspam.

Signed-off-by: Jens Reidel <adrian@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7509>
(cherry picked from commit 8473c7a59c)
2025-12-10 09:05:26 +01:00
Oliver Smith 58f09ce62b realme-porsche: remove
The kernel sources are missing:

>>> linux-realme-porsche: Fetching linux-realme-porsche-e4d90d13d227ba9cc88e7e56b6039224290117da.tar.gz::https://github.com/Saikatsaha1996/linux-sm8350/archive/e4d90d13d227ba9cc88e7e56b6039224290117da.tar.gz
Connecting to github.com (140.82.121.4:443)
Connecting to codeload.github.com (140.82.121.10:443)
wget: server returned error: HTTP/1.1 404 Not Found
2025-12-08 23:16:43 +01:00
Oliver Smith ddcbf4091e device-apple-{mac,tonga}: remove
These depend on asahi-fwextract, which isn't in Alpine stable yet:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/17786

Remove them at least for the initial bringup. If there is demand, we
could add this package to v25.12 as workaround.
2025-12-08 23:14:46 +01:00
Oliver Smith 5133c62c59 linux-asus-flo: remove
This kernel should have been removed along with device-linux-flo in
568e4c873c for v25.12.
2025-12-08 22:59:16 +01:00
Oliver Smith c0a55887b7 main/mobile-config-firefox: upgrade to 5.0.0_rc1
This MR is for v25.12 only, for edge we plan to move it over to Alpine's
aports. The build() section has been removed as with the refactoring
that was done upstream, no build step is necessary anymore.

Related: https://gitlab.postmarketos.org/postmarketOS/mobile-config-firefox/-/tags/5.0.0_rc1
[ci:skip-build]: repos still bootstrapping, tested locally

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7513>
2025-12-08 16:57:13 +00:00
Oliver Smith 84303cbe00 nokia-weeknd: remove
The sources for the kernel have disappeared, remove the device for
initial v25.12 bringup.
2025-12-08 07:36:34 +01:00
Oliver Smith 834386642b modem/unisoc-timesync-daemon: fix build
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7511>
(cherry picked from commit 4bf8b82a1b)
2025-12-07 18:06:26 +01:00
Oliver Smith 34d4ca13ff modem/unisoc-nvitem-daemon: fix build
Fix for:
  >>> unisoc-nvitem-daemon-systemd*: Running split function systemd...
  install: can't stat '90-unisoc-nvitem-daemon.preset': No such file or directory

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7511>
(cherry picked from commit 0b4c804bfc)
2025-12-07 18:06:18 +01:00
Oliver Smith b8a0c2749a temp/mesa-dri-simpledrm: set builddir to fix build
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7511>
(cherry picked from commit a60830d3cb)
2025-12-07 18:06:12 +01:00
Oliver Smith 4c040d00a2 device/testing: set builddir to fix builds
With recent abuild changes, these packages don't build anymore. Set
builddir="$srcdir" for these packages to get the previous behavior and
have the builds fixed.

[ci:ignore-count]

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7511>
(cherry picked from commit 7203fa22b0)
2025-12-07 18:06:06 +01:00
Oliver Smith 0097cf3202 soc-qcom-msm8916: fix build
Fix for:
  >>> soc-qcom-msm8916-rproc*: Running split function rproc...
  install: can't stat 'q6voiced.conf': No such file or directory

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7511>
(cherry picked from commit 6ad93a1713)
2025-12-07 18:05:59 +01:00
Oliver Smith 5304a2108d inet-a33: remove 2025-12-07 18:01:20 +01:00
Oliver Smith e7435ab2e6 pocketbook-614-plus: remove 2025-12-07 18:00:16 +01:00
Oliver Smith 1c219517e3 lark-freeme: remove 2025-12-07 17:59:55 +01:00
Oliver Smith 7bf6c291e2 goclever-gcta741l: remove 2025-12-07 17:59:29 +01:00
Oliver Smith 2583a52f54 tokio-techbook: remove 2025-12-07 17:59:03 +01:00
Oliver Smith 24aa2c92f8 ouya-ouya: remove 2025-12-07 17:58:33 +01:00
Oliver Smith 568e4c873c asus-flo: remove 2025-12-07 17:58:05 +01:00
Oliver Smith b75a678984 sourceparts-pocketpc: remove 2025-12-07 17:57:35 +01:00
Oliver Smith 0130364ed3 pine64-rock64: remove 2025-12-07 17:56:54 +01:00
Oliver Smith 9eefdbbed6 powkiddy-x55: remove
Remove this device for the initial v25.12 bringup as it is in testing
and doesn't build currently.
2025-12-07 17:55:09 +01:00
Stefan Hansson d260522fdc main/postmarketos-artwork: fix wallpaper paths
These should've been updated in the earlier commit.

Fixes 78952f195e

Signed-off-by: Stefan Hansson <newbyte@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7510>
(cherry picked from commit 26a458efc0)
2025-12-07 17:42:29 +01:00
Stefan Hansson d97cb34b92 main/postmarketos-artwork: remove use of deprecated "convert"
The "convert" command and subcommand is deprecated. Use "magick"
instead.

Signed-off-by: Stefan Hansson <newbyte@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7502>
(cherry picked from commit 213f0eccac)
2025-12-07 17:42:20 +01:00
Stefan Hansson 4bbcdbe630 main/postmarketos-artwork: set v25.12 wallpaper
This time "Sward" by Dikasp won[1].

 [1]: https://social.treehouse.systems/@postmarketOS/115640026538543141

Signed-off-by: Stefan Hansson <newbyte@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7502>
(cherry picked from commit 78952f195e)
2025-12-07 17:42:13 +01:00
Oliver Smith cf6764a152 main/postmarketos-ui-lomiri: remove
Depends on lomiri from Alpine testing.
2025-12-07 16:27:06 +01:00
Oliver Smith 612541620b main/postmarketos-ui-cosmic: remove
Depends on cosmic-session from Alpine testing.
2025-12-07 16:27:06 +01:00
Oliver Smith 03d8f0e48a main/postmarketos-ui-bananui: remove
Depends on bananui-clock from Alpine testing.
2025-12-07 16:27:06 +01:00
Oliver Smith 1e65a70505 main/postmarketos-ui-mediaberry: remove
Depends on temp/mbwl, which was just removed as it depends on
wlroots0.17-dev from Alpine testing.
2025-12-07 16:27:06 +01:00
Oliver Smith 382a3c0633 temp/mbwl: remove
Depends on wlroots0.17-dev from Alpine's testing repo.
2025-12-07 16:27:06 +01:00
Oliver Smith 7c443250f0 device/{downstream,archived}: remove for v25.12 2025-12-07 16:27:06 +01:00
Oliver Smith 61c2f888ef cross/*: regenerate for v25.12 2025-12-07 16:27:06 +01:00
Oliver Smith 6c652d7899 Remove packages for stable branch 2025-12-07 16:27:05 +01:00
Oliver Smith 3439d1246b main/postmarketos-base: set version to v25.12 2025-12-07 16:27:05 +01:00
Oliver Smith 6c7f62307f === Branch v25.12 from master ===
Related: https://wiki.postmarketos.org/wiki/Create_release_branch
2025-12-07 16:27:05 +01:00
4645 changed files with 2252 additions and 1645214 deletions

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
apk add git openssh-keygen grep curl
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
sh ./install_pmbootstrap.sh
exec su "${TESTUSER:-pmos}" -c "sh -e $0 $*"
fi
@@ -89,7 +89,7 @@ update_linux_next() {
git remote add gitlab https://pmos-ci:"$PMAPORTS_PUSH_TOKEN"@gitlab.postmarketos.org/postmarketOS/pmaports.git
git fetch gitlab
git checkout --track gitlab/master
git checkout --track gitlab/main
for pkg in $PKGS; do
case "$pkg" in
-1
View File
@@ -1 +0,0 @@
lib/build_changed_aports.sh
+1 -1
View File
@@ -11,7 +11,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
apk -q add py3-pip make git
apk add dint --allow-untrusted --repository=https://mirror.postmarketos.org/postmarketos/master
apk add dint --allow-untrusted --repository=https://mirror.postmarketos.org/postmarketos/main
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
-1
View File
@@ -1 +0,0 @@
lib/build_changed_aports.sh
-1
View File
@@ -1 +0,0 @@
lib/build_changed_aports.sh
-1
View File
@@ -1 +0,0 @@
lib/build_changed_aports.sh
+1 -1
View File
@@ -11,7 +11,7 @@ if [ "$(id -u)" = 0 ]; then
# 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.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
sh ./install_pmbootstrap.sh
fi
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
+1 -1
View File
@@ -6,7 +6,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
apk add git python3
apk add dint --allow-untrusted --repository=https://mirror.postmarketos.org/postmarketos/master
apk add dint --allow-untrusted --repository=https://mirror.postmarketos.org/postmarketos/main
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
+1 -1
View File
@@ -6,7 +6,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
sh ./install_pmbootstrap.sh
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
fi
+1 -1
View File
@@ -5,7 +5,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
sh ./install_pmbootstrap.sh
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
fi
+1 -1
View File
@@ -25,7 +25,7 @@ def get_package_contents(package, revision, check=True):
if not check:
stderr = subprocess.DEVNULL
# Run something like "git show upstream/master:main/hello-world/APKBUILD"
# Run something like "git show upstream/main:main/hello-world/APKBUILD"
pmaports_dir = common.get_pmaports_dir()
pattern = pmaports_dir + "/**/" + package + "/APKBUILD"
path = glob.glob(pattern, recursive=True)[0][len(pmaports_dir + "/"):]
+1 -1
View File
@@ -90,7 +90,7 @@ def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--booting", help="devices must be in the upper table,"
" being in the 'not booting' table below is not"
" enough (all devices in pmaports master and stable"
" enough (all devices in pmaports main and stable"
" branches and should be in the upper table)",
action="store_true")
parser.add_argument("--path", help="instead of downloading the devices"
+3 -3
View File
@@ -53,7 +53,7 @@ def run_pmbootstrap(parameters):
def get_upstream_branch():
""" Use pmaports.cfg from current branch (e.g. "v20.05_fix-ci") and
channels.cfg from master to retrieve the upstream branch.
channels.cfg from main to retrieve the upstream branch.
:returns: branch name, e.g. "v20.05" """
@@ -74,13 +74,13 @@ def get_upstream_branch():
# Get branch_pmaports (e.g. "v20.05") from channels.cfg
# https://postmarketos.org/channels.cfg
channels_cfg_str = run_git(["show", "upstream/master:channels.cfg"])
channels_cfg_str = run_git(["show", "upstream/main:channels.cfg"])
channels_cfg = configparser.ConfigParser()
channels_cfg.read_string(channels_cfg_str)
assert channel in channels_cfg, \
f"Channel '{channel}' from pmaports.cfg in your branch is unknown." \
" This appears to be an old branch, consider recreating your change" \
" on top of master."
" on top of main."
ret = channels_cfg[channel]["branch_pmaports"]
cache["upstream_branch"] = ret
-4
View File
@@ -144,12 +144,8 @@ class Device:
class ArchTagSet(set):
supported_arches = [
Arch.x86_64,
Arch.x86,
Arch.aarch64,
Arch.armv7,
Arch.armhf,
Arch.riscv64,
Arch.ppc64le,
]
def update(self, iterable):
+1 -1
View File
@@ -8,7 +8,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
sh ./install_pmbootstrap.sh pytest
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
fi
+1
View File
@@ -27,6 +27,7 @@ def args(request):
args.offline = False
args.action = "init"
args.cross = False
args.ccache = False
args.log = None
init_args(args)
+1 -1
View File
@@ -6,7 +6,7 @@
if [ "$(id -u)" = 0 ]; then
set -x
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
sh ./install_pmbootstrap.sh
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
fi
+2 -2
View File
@@ -153,7 +153,7 @@ mr-settings:
before_script:
- apk -q add python3
script:
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/check_mr_settings.py"
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/check_mr_settings.py"
- python3 ./check_mr_settings.py
# Calculate build of changed aports using a dynamic downstream pipelines:
@@ -172,7 +172,7 @@ generate-build-jobs:
- .ci/lib/gitlab_prepare_ci.sh
needs: []
script:
- wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
- wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
- sh ./install_pmbootstrap.sh py3-jinja2
# HACK: Make the pmb library happy to use the currently-cloned pmaports repo
+1 -1
View File
@@ -26,7 +26,7 @@
<!--
Replace space inside `[ ]` with `x` to fill the checkbox
-->
* [ ] edge (`master` branch)
* [ ] edge (`main` branch)
* [ ] `v25.06`
* [ ] I confirm that the issue still is present after running `sudo apk upgrade -a`
-81
View File
@@ -1,81 +0,0 @@
# Reference: https://postmarketos.org/channels.cfg
[channels.cfg]
recommended=edge
[edge]
description=Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
branch_pmaports=master
branch_aports=master
mirrordir_alpine=edge
[v25.12]
description=Upcoming stable release (DO NOT USE)
branch_pmaports=v25.12
branch_aports=master
mirrordir_alpine=v3.23
[v25.06]
description=Latest release / Recommended for best stability
branch_pmaports=v25.06
branch_aports=3.22-stable
mirrordir_alpine=v3.22
[v24.12]
description=Old release (unsupported)
branch_pmaports=v24.12
branch_aports=3.21-stable
mirrordir_alpine=v3.21
[v24.06]
description=Old release (unsupported)
branch_pmaports=v24.06
branch_aports=3.20-stable
mirrordir_alpine=v3.20
[v23.12]
description=Old release (unsupported)
branch_pmaports=v23.12
branch_aports=3.19-stable
mirrordir_alpine=v3.19
[v23.06]
description=Old release (unsupported)
branch_pmaports=v23.06
branch_aports=3.18-stable
mirrordir_alpine=v3.18
[v22.12]
description=Old release (unsupported)
branch_pmaports=v22.12
branch_aports=3.17-stable
mirrordir_alpine=v3.17
[v22.06]
description=Old release (unsupported)
branch_pmaports=v22.06
branch_aports=3.16-stable
mirrordir_alpine=v3.16
[v21.12]
description=Old release (unsupported)
branch_pmaports=v21.12
branch_aports=3.15-stable
mirrordir_alpine=v3.15
[v21.06]
description=Old release (unsupported)
branch_pmaports=v21.06
branch_aports=3.14-stable
mirrordir_alpine=v3.14
[v21.03]
description=Old release (unsupported)
branch_pmaports=v21.03
branch_aports=3.13-stable
mirrordir_alpine=v3.13
[v20.05]
description=Old release (unsupported)
branch_pmaports=v20.05
branch_aports=3.12-stable
mirrordir_alpine=v3.12
+1 -1
View File
@@ -2,7 +2,7 @@ cross-gcc-tests:
extends: .package-test
tags: [qemu]
before_script:
- wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
- wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/install_pmbootstrap.sh"
- sh ./install_pmbootstrap.sh
script:
- su pmos -c "pmbootstrap build gcc-aarch64"
@@ -1,130 +0,0 @@
From 824eae920f0f64dd7687c969a2436b129161fdc9 Mon Sep 17 00:00:00 2001
From: Jinyang He <hejinyang@loongson.cn>
Date: Wed, 29 Oct 2025 16:07:35 +0800
Subject: [PATCH] LoongArch: Only allow valid binary op when optimize
conditional move
It is wrong that optimize from `if (cond) dest op= 1 << shift` to
`dest op= (cond ? 1 : 0) << shift` when `dest op 0 != dest`.
Like `and`, `mul` or `div`.
And in this optimization `mul` and `div` is optimized to shift.
gcc/ChangeLog:
* config/loongarch/loongarch.cc
(loongarch_expand_conditional_move): Only allow valid binary
op when optimize conditional move.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/conditional-move-opt-1.c: Remove mul.
* gcc.target/loongarch/conditional-move-opt-2.c: Remove and.
* gcc.target/loongarch/conditional-move-opt-3.c: New test.
Co-Authored-By: Peng Fan <fanpeng@loongson.cn>
---
gcc/config/loongarch/loongarch.cc | 26 ++++++++++++++++---
.../loongarch/conditional-move-opt-1.c | 4 +--
.../loongarch/conditional-move-opt-2.c | 2 +-
.../loongarch/conditional-move-opt-3.c | 14 ++++++++++
4 files changed, 40 insertions(+), 6 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index bdf290654..740c8611a 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -5533,12 +5533,32 @@ loongarch_expand_conditional_move (rtx *operands)
}
}
+ auto is_binary_op_0_keep_orig = [](enum rtx_code code)
+ {
+ switch (code)
+ {
+ case PLUS:
+ case MINUS:
+ case IOR:
+ case XOR:
+ case ROTATE:
+ case ROTATERT:
+ case ASHIFT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+ return true;
+ default:
+ return false;
+ }
+ };
+
/* Check if the optimization conditions are met. */
if (value_if_true_insn
&& value_if_false_insn
- /* Make sure that value_if_false and var are the same. */
- && BINARY_P (value_if_true_insn_src
- = SET_SRC (single_set (value_if_true_insn)))
+ /* Make sure that the orig value OP 0 keep orig. */
+ && (value_if_true_insn_src
+ = SET_SRC (single_set (value_if_true_insn)))
+ && is_binary_op_0_keep_orig ( GET_CODE (value_if_true_insn_src))
/* Make sure that both value_if_true and value_if_false
has the same var. */
&& rtx_equal_p (XEXP (value_if_true_insn_src, 0),
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
index ed13471aa..47802aa96 100644
--- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
@@ -27,7 +27,7 @@ void
test_lt ()
{
if (lm < ln)
- lr *= (1 << 16);
+ lr += (1 << 16);
lr += lm;
}
@@ -35,7 +35,7 @@ void
test_le ()
{
if (lm <= ln)
- lr = lm * ((long)1 << 32);
+ lr = lm + ((long)1 << 32);
else
lr = lm;
lr += lm;
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
index ac72d4d93..743fd5e67 100644
--- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
@@ -29,7 +29,7 @@ void
test_lez ()
{
if (lm <= 0)
- lr &= (1 << 16);
+ lr |= (1 << 16);
lr += lm;
}
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
new file mode 100644
index 000000000..95887980c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "maskeqz" } } */
+/* { dg-final { scan-assembler "masknez" } } */
+
+extern long lm, ln, lr;
+
+void
+test_and ()
+{
+ if (lm < 0)
+ lr &= (1 << 16);
+ lr += lm;
+}
--
2.51.1
-42
View File
@@ -1,42 +0,0 @@
From 94cf7d2b3514ed3a4401861a519ead450e022afc 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 d1d79a32fc9..069c3bb8324 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;
--
2.50.1
@@ -1,77 +0,0 @@
From 21b7d08714c4964403848db4144003835ff5245a Mon Sep 17 00:00:00 2001
From: Linsen Zhou <i@lin.moe>
Date: Fri, 17 Oct 2025 11:05:04 +0800
Subject: [PATCH] tree-object-size.cc: Fix assert constant offset in
check_for_plus_in_loops [PR122012]
After commit 51b85dfeb19652bf3e0aaec08828ba7cee1e641c, when the
pointer offset is a variable in the loop, the object size of the
pointer may also need to be reexamined.
Which make gcc_assert in the check_for_plus_in_loops failed.
gcc/ChangeLog:
PR tree-optimization/122012
* tree-object-size.cc (check_for_plus_in_loops): Skip check
for the variable offset
gcc/testsuite/ChangeLog:
PR tree-optimization/122012
* gcc.dg/torture/pr122012.c: New test.
Signed-off-by: Linsen Zhou <i@lin.moe>
(cherry picked from commit 82cefc4898d4ccabe76e28d6626b91ca9e998923)
---
gcc/testsuite/gcc.dg/torture/pr122012.c | 18 ++++++++++++++++++
gcc/tree-object-size.cc | 7 +++----
2 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr122012.c
diff --git a/gcc/testsuite/gcc.dg/torture/pr122012.c b/gcc/testsuite/gcc.dg/torture/pr122012.c
new file mode 100644
index 00000000000..055915a1e98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr122012.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+#include <stdlib.h>
+
+void foo();
+
+void test(size_t step) {
+ char *buf = malloc(64);
+ char *p = buf;
+ size_t i;
+
+ for(i = 0; i < 64; ++i) {
+ p += 4;
+ if (__builtin_object_size (p, 2) != 0)
+ foo();
+ p += step;
+ }
+ free(buf);
+}
diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
index 2d13ab79a84..76dc2446059 100644
--- a/gcc/tree-object-size.cc
+++ b/gcc/tree-object-size.cc
@@ -2153,12 +2153,11 @@ check_for_plus_in_loops (struct object_size_info *osi, tree var)
&& gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
{
tree basevar = gimple_assign_rhs1 (stmt);
- tree cst = gimple_assign_rhs2 (stmt);
-
- gcc_assert (TREE_CODE (cst) == INTEGER_CST);
+ tree offset = gimple_assign_rhs2 (stmt);
/* Skip non-positive offsets. */
- if (integer_zerop (cst) || compare_tree_int (cst, offset_limit) > 0)
+ if (TREE_CODE (offset) != INTEGER_CST
+ || integer_zerop (offset) || compare_tree_int (offset, offset_limit) > 0)
return;
osi->depths[SSA_NAME_VERSION (basevar)] = 1;
--
2.51.0
@@ -1,258 +0,0 @@
From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 23 Jan 2025 17:12:51 -0800
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".
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: sunil dora <sunilkumar.dora@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/common.opt | 4 ++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.cc | 12 ++++++++++--
gcc/incpath.cc | 25 +++++++++++++++++++++++++
7 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index e3fa0dacec4..bea1adc0940 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -729,6 +729,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 a79c51adb2b..8a531ed591c 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -249,6 +249,16 @@
#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#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 16965953f05..0f4a5d52c30 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1051,6 +1051,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_host_pie
@@ -1828,6 +1829,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
--enable-host-pie build host code as PIE
@@ -34027,6 +34030,22 @@ 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}" != "xno"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9f67e62950a..b0e3615e5aa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7502,6 +7502,22 @@ 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 (no/yes/error)]),,
+ [enable_poison_system_directories=no])
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 72009c33cd0..29aea724731 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
+-Wno-poison-system-directories
-Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor
-Wno-psabi
-Wredundant-decls -Wrestrict
@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default.
Suppress warnings from casts from a pointer to an integer type of a
different size.
+@opindex Wno-poison-system-directories
+@item -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.
+
@opindex Winvalid-pch
@opindex Wno-invalid-pch
@item -Winvalid-pch
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4fd87f2c4a1..79d4920a047 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -909,6 +909,12 @@ proper position among the other output files. */
#define ASM_MAP ""
#endif
+#ifdef POISON_BY_DEFAULT
+#define POISON_IS_ERROR " -Werror=poison-system-directories"
+#else
+#define POISON_IS_ERROR
+#endif
+
/* Assembler options for compressed debug sections. */
#if HAVE_LD_COMPRESS_DEBUG == 0
/* Reject if the linker cannot write compressed debug sections. */
@@ -1166,6 +1172,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*} %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
@@ -1268,7 +1276,7 @@ static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
%{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
@@ -1297,7 +1305,7 @@ static const char *cc1_options =
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
- %{pthread:-fprofile-update=prefer-atomic}}}";
+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
static const char *asm_options =
"%{-target-help:%:print-asm-header()} "
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index c1bbfd3872a..2cdbebc4c50 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. */
@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
cur->name, xstrerror (errno));
reason = REASON_NOENT;
}
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ pcur = &cur->next;
+ continue;
+#endif
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
fprintf (stderr, _("End of #embed 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
--
2.50.1
@@ -1,44 +0,0 @@
From 90e8697dd88fd99ce2cf8739e95494853005377e 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 29aea724731..6fb3ab70cc7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -19477,6 +19477,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}.
+
@opindex u
@item -u @var{symbol}
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 79d4920a047..74a356fdf5e 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1170,6 +1170,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} \
--
2.50.1
@@ -1,46 +0,0 @@
From 17c9cf9272077bc7ac784daffd4c68ba1ce67a0d 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 4589ee4a3a6..9edf095384c 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1581,6 +1581,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 6fb3ab70cc7..799ce073dbf 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12840,6 +12840,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}.
+
@opindex O3
@item -O3
Optimize yet more. @option{-O3} turns on all optimizations specified
--
2.50.1
@@ -1,286 +0,0 @@
From 95d8fac6247b2cba1142261cc95c21063539112a 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/loongarch/gnu-user.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 ++++++++++++++++++++--------
15 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 116bb4e69f3..daf99f8dce9 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -39,6 +39,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 3fd3b831166..0b4c2dccebe 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 d4d389e2aa8..adccc0b11c2 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 4c4e31efa39..3c17ac6eade 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 "%{!shared:libhwasan_preinit%O%s} " \
"%{static-libhwasan:%{!shared:" \
@@ -146,12 +146,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 7abfda53049..ceb8f855b7d 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 abe714711bf..3ca128a79f5 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 a2494c214c4..e1a5d530cdf 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/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
index fbc75a90ad5..adbc4b7733f 100644
--- a/gcc/config/loongarch/gnu-user.h
+++ b/gcc/config/loongarch/gnu-user.h
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC \
- "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \
+ "%{G*} %{shared} --as-needed -m " GNU_USER_LINK_EMULATION \
"%{!shared: %{static} " \
"%{!static: %{!static-pie: %{rdynamic:-export-dynamic} " \
"-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} " \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5a82508c113..6eee7cdc603 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 9060c940a44..282c77b6a7b 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -48,6 +48,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} \
-X \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 0316d8cb65d..139e1b6796c 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -378,13 +378,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 afb5c6ad867..b64638fb25b 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -781,7 +781,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 2c3bca5dfcb..b90661247a4 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 6d928846895..3cc05bb7240 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 74a356fdf5e..fc9c7d15b04 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -774,8 +774,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
@@ -810,8 +813,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
@@ -828,8 +834,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
@@ -844,8 +853,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
--
2.50.1
@@ -1,34 +0,0 @@
From 58a94690d4dd7b34543d9d154abc96d2d90d3b32 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 75b6531860e..78830ce4b42 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end
of the destination region.
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
@@ -830,7 +830,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.
Wframe-address
--
2.50.1
@@ -1,25 +0,0 @@
From b2a755b671d88c34402290d7d769232e01aed350 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:44:20 -0700
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 bea1adc0940..e65a575d9f8 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -829,7 +829,7 @@ Common Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wa
Warn if a comparison always evaluates to true or false.
Wtrampolines
-Common Var(warn_trampolines) Warning
+Common Var(warn_trampolines) Init(1) Warning
Warn whenever a trampoline is generated.
Wtrivial-auto-var-init
--
2.50.1
@@ -1,39 +0,0 @@
From c355364231395090e7223ec00d8a16065903c2c5 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:49:03 -0700
Subject: [PATCH] gcc: disable SSP on -ffreestanding, -nostdlib and
-nodefaultlibs
---
gcc/gcc.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fc9c7d15b04..7b0d3d2743b 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1009,6 +1009,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" \
@@ -1314,7 +1320,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|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
--
2.50.1
@@ -1,25 +0,0 @@
From 5f09842c19d6db976724cd117190a8a6951acf9b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:50:42 -0700
Subject: [PATCH] gcc: params: set default ssp-buffer-size to 4
---
gcc/params.opt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/params.opt b/gcc/params.opt
index 64e453d29b7..bba3fd574f2 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1064,7 +1064,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=
--
2.50.1
@@ -1,54 +0,0 @@
From ee0615536ae0d255f59070b904aa35d6de8fce49 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 7f84a99533e..a4c6284f788 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 8e93445acd2..d6ff06e5ddb 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)
--
2.50.1
@@ -1,28 +0,0 @@
From 62966418472466142a9962892177f4b1f9f56944 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 d4e8791b14b..c074980ed80 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -678,8 +678,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. */
--
2.50.1
@@ -1,24 +0,0 @@
From 0351f4f3dd00bdece780ce5e24d972e97ca1b7ed 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 ce54d88278d..10c212a1ad3 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -266,6 +266,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi
--
2.50.1
-57
View File
@@ -1,57 +0,0 @@
From bd7e32d5405b6b4f3994a212a77ff2cd33134c74 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 cdfd94d3c73..a3a6c988833 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -13643,10 +13643,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 2484dc839bf..e980030ef23 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)
--
2.50.1
-85
View File
@@ -1,85 +0,0 @@
From c191dc86f4f7340542066f4156aa57be9cfbf876 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 | 25 +++++++++++++++++++++++++
gcc/configure.ac | 11 +++++++++++
2 files changed, 36 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 0f4a5d52c30..343563c8948 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -34586,6 +34586,29 @@ rm -f core conftest.err conftest.$ac_objext \
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
$as_echo "$gcc_cv_no_pie" >&6; }
+# 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 ${gcc_cv_nopie+:} false; 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 x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -34603,6 +34626,8 @@ if test x$enable_host_pie = xyes; then
LD_PICFLAG=-pie
elif test x$gcc_cv_no_pie = xyes; then
LD_PICFLAG=-no-pie
+elif test x$gcc_cv_nopie = xyes; then
+ LD_PICFLAG=-nopie
else
LD_PICFLAG=
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b0e3615e5aa..b3948469d17 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7802,6 +7802,15 @@ AC_CACHE_CHECK([for -no-pie option],
[gcc_cv_no_pie=yes],
[gcc_cv_no_pie=no])
LDFLAGS="$saved_LDFLAGS"])
+# Check if -nopie works.
+AC_CACHE_CHECK([for -nopie option],
+ [gcc_cv_nopie],
+ [saved_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -nopie"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
+ [gcc_cv_nopie=yes],
+ [gcc_cv_nopie=no])
+ LDFLAGS="$saved_LDFLAGS"])
if test x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -7819,6 +7828,8 @@ if test x$enable_host_pie = xyes; then
LD_PICFLAG=-pie
elif test x$gcc_cv_no_pie = xyes; then
LD_PICFLAG=-no-pie
+elif test x$gcc_cv_nopie = xyes; then
+ LD_PICFLAG=-nopie
else
LD_PICFLAG=
fi
--
2.50.1
@@ -1,42 +0,0 @@
From f1d6c0950e0f12fb8cf2429da570f478a1369286 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 9e3385ca94f..2c0cca6e480 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";
--
2.50.1
@@ -1,24 +0,0 @@
From 8773e0cf880da9fe80de7f8a662359664bb0b234 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 b1ed67d3d4f..1e039c20550 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -179,6 +179,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.
--
2.50.1
@@ -1,25 +0,0 @@
From 625b8095796f24389fdda5bb5bc6ff9fbb365813 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 d6280a4d4dd..ba69fb9fad7 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -159,6 +159,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
--
2.50.1
@@ -1,31 +0,0 @@
From c557286adc46536fe033df400c50a880b672cfd6 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 7b0d3d2743b..e46e976a2e8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1017,8 +1017,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" \
--
2.50.1
@@ -1,69 +0,0 @@
From d698fead9d201ef032e2e978898864335a9ab513 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 e46e976a2e8..607c8ca1d42 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -775,10 +775,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
@@ -814,10 +814,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
@@ -835,10 +835,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
@@ -854,10 +854,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
--
2.50.1
@@ -1,26 +0,0 @@
From 9cf1916bd52d61ea0fd7a8b6acebb1dc4a1f2488 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 70e36b3299e..e00c3becd3f 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)
--
2.50.1
@@ -1,25 +0,0 @@
From dc07fb7df8d4f997877d8f98ea9ef8292f738ed3 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
--
2.50.1
@@ -1,81 +0,0 @@
From 496067ded4a3698468412e240b899755d92b314c 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 f56b47c268e..c5f757a6284 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}
--
2.50.1
@@ -1,26 +0,0 @@
From 3d0f96f3f53a7ff81532f077e9db69d7318db796 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 64a4a20e64f..9a8eb8dd8d1 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)
--
2.50.1
@@ -1,78 +0,0 @@
From b1ab523d6fa44aae8f3ec5f787a8f86f8686bf64 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 | 8 --------
gcc/config/riscv/t-linux | 7 +++++--
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 282c77b6a7b..07adae3d59c 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
%{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
-
-#define STARTFILE_PREFIX_SPEC \
- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/lib/ " \
- "/usr/lib/ "
-
-#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
index a6f64f88d25..f88776ec520 100644
--- a/gcc/config/riscv/t-linux
+++ b/gcc/config/riscv/t-linux
@@ -1,5 +1,8 @@
-# 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
MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
--
2.50.1
@@ -1,51 +0,0 @@
From ee64e5ead8938d5be6cedd674158a25d93711fe3 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 0719fd0615d..80bb8f1622f 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -971,8 +971,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)
@@ -1177,10 +1178,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))))
@@ -1197,6 +1194,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; \
--
2.50.1
@@ -1,59 +0,0 @@
From 5adfe740c027fb8dc9931053f55f7eae222e6bb4 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:09:02 -0700
Subject: [PATCH] ada: libgnarl: remove use of glibc-specific
pthread_rwlockattr_setkind_np
musl's thread library does not implement it
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/libgnarl/s-osinte__linux.ads | 10 ----------
gcc/ada/libgnarl/s-taprop__linux.adb | 7 -------
2 files changed, 17 deletions(-)
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
index 7aeb15da523..5551b701e5a 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -402,16 +402,6 @@ package System.OS_Interface is
(attr : access pthread_rwlockattr_t) return int;
pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
- PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
- 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;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index 8f4c835baa7..6df36c7d8f4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is
Result : C.int;
begin
- -- Set the rwlock to prefer writer to avoid writers starvation
-
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);
--
2.50.1
@@ -1,50 +0,0 @@
From c8edb618208a854d121ff73c0d82d7cc467a3611 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:13:19 -0700
Subject: [PATCH] ada: libgnarl: use posix_openpt instead of glibc-specific
getpt to open a pty
musl only implements posix_openpt(3), not the older glibc-specific getpt()
and glibc implements both for ages.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/terminals.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 89f887556c0..93557fe2631 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1134,7 +1134,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
@@ -1148,7 +1148,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)
@@ -1197,8 +1197,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)
--
2.50.1
@@ -1,54 +0,0 @@
From d3c515c40b9ec0133787388ae7df037e88a95f73 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:18:49 -0700
Subject: [PATCH] ada: libgnarl: adaint: fix sched.h inclusion for musl
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/adaint.c | 6 +++++-
gcc/ada/adaint.h | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 1fcfae165a7..67318e647ed 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -95,6 +95,11 @@
#include <sys/pstat.h>
#endif
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
#endif
@@ -3476,7 +3481,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
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 3df12b5f956..26a489f2b78 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -40,6 +40,11 @@ extern "C" {
#include "mingw32.h"
#endif
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
#include <dirent.h>
/* Constants used for the form parameter encoding values */
--
2.50.1
@@ -1,256 +0,0 @@
From 3d13edda0134af3fbb802cdec6406c91003bbc33 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Wed, 9 Dec 2020 07:42:06 +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 | 31 ++++++++++++++++++++++++++++++-
gcc/configure.ac | 21 +++++++++++++++++++++
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(+), 5 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 1e039c20550..20f535a306a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -238,6 +238,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 8a531ed591c..40045ff35a5 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -131,6 +131,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 3c17ac6eade..0426efdb8c3 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 343563c8948..54300a2a867 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1003,6 +1003,7 @@ with_changes_root_url
enable_languages
with_multilib_list
with_multilib_generator
+enable_autolink_libatomic
with_zstd
with_zstd_include
with_zstd_lib
@@ -1742,6 +1743,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
@@ -8400,7 +8404,6 @@ else
fi
-
# Check whether --with-multilib-generator was given.
if test "${with_multilib_generator+set}" = set; then :
withval=$with_multilib_generator; :
@@ -8408,6 +8411,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
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b3948469d17..81c070830e2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1227,6 +1227,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
# -------------------------
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3e9e09b4ae3..6e7b756be61 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2617,6 +2617,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 a96700c0d38..16deedca64d 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -390,7 +390,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 eccc4d88493..4ca4c610571 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -390,7 +390,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 607c8ca1d42..e9f78f0f4c1 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1000,13 +1000,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
--
2.50.1
@@ -1,57 +0,0 @@
From ddc31942d7363acc938007d70f29e3e324064f76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 29 Aug 2021 12:23:34 +0200
Subject: [PATCH] configure: fix detection of atomic builtins in libatomic
configure script
Alpine's --enable-autolink-libatomic (which is enabled for riscv64 by
default) causes the libatomic configure script to incorrectly detect
which builtins are available on riscv64. This then causes incorrect code
generation for libatomic since it assumes compiler builtins to be
available which are not actually available on riscv64.
This commit fixes this issue by disabling linking of libatomic configure
test code entirely, thereby preventing linking against libatomic.
See:
* https://gitlab.alpinelinux.org/alpine/aports/-/issues/12948
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c6
---
libatomic/configure.tgt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 6db039d6e8b..2751b5c1387 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -30,6 +30,26 @@
# on ${target_cpu}. For example to allow proper use of multilibs.
configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
+# The libatomic configure script performs several checks to determine
+# whether builtins for atomic operations are available. When compiling
+# with --enable-autolink-libatomic the test code compiled by the
+# configure script is also linked against libatomic. This causes it
+# to think that builtins are available, even if there are not, since
+# the tested symbols are provided by libatomic.
+#
+# This is a hack to ensure that we don't link against libatomic by not
+# linking any configure test code at all when --enable-autolink-libatomic
+# is given.
+#
+# See:
+#
+# * https://gitlab.alpinelinux.org/alpine/aports/-/issues/12817
+# * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c4
+#
+if test x$enable_autolink_libatomic = xyes; then
+ gcc_no_link=yes
+fi
+
case "${target_cpu}" in
alpha*)
# fenv.c needs this option to generate inexact exceptions.
--
2.50.1
@@ -1,27 +0,0 @@
From e9f4662af949bc56eef27d531605dd90181bc300 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 30 Jun 2022 16:44:51 +0000
Subject: [PATCH] libstdc++: do not throw exceptions for non-C locales on musl
targets
---
libstdc++-v3/config/locale/generic/c_locale.cc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
index bfd02b5c2c6..16f9e84d66f 100644
--- a/libstdc++-v3/config/locale/generic/c_locale.cc
+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
@@ -242,9 +242,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Currently, the generic model only supports the "C" locale.
// See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
__cloc = 0;
- if (strcmp(__s, "C"))
- __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
- "name not valid"));
}
void
--
2.50.1
@@ -1,26 +0,0 @@
From b4c412a5d538f7478596880e89d0e6d5046ef16b Mon Sep 17 00:00:00 2001
From: Mathias LANG <pro.mathias.lang@gmail.com>
Date: Mon, 17 Jan 2022 03:49:21 +0000
Subject: [PATCH] gdc: unconditionally link libgphobos against libucontext
ref: alpine/aports#13422
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 20f535a306a..c087bfe7cd4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -54382,7 +54382,7 @@ configure-target-libphobos:
esac; \
module_srcdir=libphobos; \
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} \
--
2.50.1
@@ -1,54 +0,0 @@
From 0c10e5ee09685a5ecc39650e8ec8a1b4f5e096e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 16 Jul 2022 09:21:11 +0200
Subject: [PATCH] druntime: link against libucontext on all platforms
On musl-based Linux distributions, swapcontext etc. are not provided by
musl but instead by libucontext. Hence, we _always_ need to link against
an external library for these functions.
---
libphobos/configure | 8 --------
libphobos/m4/druntime/libraries.m4 | 8 --------
2 files changed, 16 deletions(-)
diff --git a/libphobos/configure b/libphobos/configure
index 4f5be7d4ff4..0a48032edb4 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -15420,14 +15420,6 @@ fi
# Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
# "yes" for targets that have 'version = AsmExternal'.
druntime_fiber_asm_external=no
- case "$target_cpu" in
- aarch64* | \
- arm* | \
- i[34567]86|x86_64 | \
- powerpc)
- druntime_fiber_asm_external=yes
- ;;
- esac
if test "$druntime_fiber_asm_external" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
$as_echo_n "checking for library containing swapcontext... " >&6; }
diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4
index 8dd9c7da107..b61bf528a14 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -220,14 +220,6 @@ AC_DEFUN([DRUNTIME_LIBRARIES_UCONTEXT],
# Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
# "yes" for targets that have 'version = AsmExternal'.
druntime_fiber_asm_external=no
- case "$target_cpu" in
- aarch64* | \
- arm* | \
- i[[34567]]86|x86_64 | \
- powerpc)
- druntime_fiber_asm_external=yes
- ;;
- esac
if test "$druntime_fiber_asm_external" = no; then
AC_SEARCH_LIBS([swapcontext], [c ucontext], [],
AC_MSG_ERROR([swapcontext required but not found]))
--
2.50.1
@@ -1,25 +0,0 @@
From e5190522319c315efaf9a921737c05fae6a49e85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Tue, 19 Jul 2022 14:54:07 +0200
Subject: [PATCH] libgnat: time_t is always 64-bit on musl libc
---
gcc/ada/libgnat/s-parame.ads | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/ada/libgnat/s-parame.ads b/gcc/ada/libgnat/s-parame.ads
index 98284a4d13e..0d14f116a10 100644
--- a/gcc/ada/libgnat/s-parame.ads
+++ b/gcc/ada/libgnat/s-parame.ads
@@ -101,7 +101,7 @@ package System.Parameters is
-- Characteristics of time_t type --
------------------------------------
- time_t_bits : constant := Long_Integer'Size;
+ time_t_bits : constant := Long_Long_Integer'Size;
-- Number of bits in type time_t
----------------------------------------------
--
2.50.1
@@ -1,30 +0,0 @@
From 3fe1ff6c349a065daba97794c55961cafe6c4a10 Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 29 May 2023 15:33:11 +0000
Subject: [PATCH] libphobos: do not use LFS64 symbols
musl does not have these since 1.2.4, we can't use the compat interfaces.
---
libphobos/libdruntime/core/sys/posix/sys/mman.d | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d
index b1eb9fa8107..3aee0d96319 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d
@@ -293,11 +293,7 @@ else version (CRuntime_Bionic)
}
else version (CRuntime_Musl)
{
- static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t);
- static if (__USE_FILE_OFFSET64)
- alias mmap = mmap64;
- else
- void* mmap(void*, size_t, int, int, int, off_t);
+ void* mmap(void*, size_t, int, int, int, off_t);
int munmap(void*, size_t);
}
else version (CRuntime_UClibc)
--
2.50.1
@@ -1,195 +0,0 @@
From ff21b1649c1c5009a33722d21e28af9026c72cd7 Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 10 Jul 2023 23:23:29 +0000
Subject: [PATCH] libgo: fix lfs64 use
---
.../go/internal/syscall/unix/at_largefile.go | 2 +-
libgo/go/os/dir_largefile.go | 2 +-
libgo/go/syscall/libcall_glibc.go | 2 +-
libgo/go/syscall/libcall_linux.go | 4 +--
libgo/go/syscall/libcall_posix_largefile.go | 26 +++++++++----------
libgo/runtime/go-varargs.c | 2 +-
libgo/sysinfo.c | 9 +++----
7 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/libgo/go/internal/syscall/unix/at_largefile.go b/libgo/go/internal/syscall/unix/at_largefile.go
index 82e0dcfd074..16151ecad1b 100644
--- a/libgo/go/internal/syscall/unix/at_largefile.go
+++ b/libgo/go/internal/syscall/unix/at_largefile.go
@@ -10,5 +10,5 @@ import (
"syscall"
)
-//extern fstatat64
+//extern fstatat
func fstatat(int32, *byte, *syscall.Stat_t, int32) int32
diff --git a/libgo/go/os/dir_largefile.go b/libgo/go/os/dir_largefile.go
index 1fc5ee0771f..0c6dffe1a75 100644
--- a/libgo/go/os/dir_largefile.go
+++ b/libgo/go/os/dir_largefile.go
@@ -11,5 +11,5 @@ package os
import "syscall"
-//extern readdir64
+//extern readdir
func libc_readdir(*syscall.DIR) *syscall.Dirent
diff --git a/libgo/go/syscall/libcall_glibc.go b/libgo/go/syscall/libcall_glibc.go
index 5c1ec483c75..5a1245ed44b 100644
--- a/libgo/go/syscall/libcall_glibc.go
+++ b/libgo/go/syscall/libcall_glibc.go
@@ -114,7 +114,7 @@ func Pipe2(p []int, flags int) (err error) {
}
//sys sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error)
-//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
+//sendfile(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if race.Enabled {
diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
index 03ca7261b59..ad21fd0b3ac 100644
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -158,7 +158,7 @@ func Reboot(cmd int) (err error) {
//adjtimex(buf *Timex) _C_int
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
-//fstatfs64(fd _C_int, buf *Statfs_t) _C_int
+//fstatfs(fd _C_int, buf *Statfs_t) _C_int
func Gettid() (tid int) {
r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0)
@@ -245,7 +245,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i
}
//sys Statfs(path string, buf *Statfs_t) (err error)
-//statfs64(path *byte, buf *Statfs_t) _C_int
+//statfs(path *byte, buf *Statfs_t) _C_int
//sysnb Sysinfo(info *Sysinfo_t) (err error)
//sysinfo(info *Sysinfo_t) _C_int
diff --git a/libgo/go/syscall/libcall_posix_largefile.go b/libgo/go/syscall/libcall_posix_largefile.go
index f90055bb29a..334212f0af1 100644
--- a/libgo/go/syscall/libcall_posix_largefile.go
+++ b/libgo/go/syscall/libcall_posix_largefile.go
@@ -10,40 +10,40 @@
package syscall
//sys Creat(path string, mode uint32) (fd int, err error)
-//creat64(path *byte, mode Mode_t) _C_int
+//creat(path *byte, mode Mode_t) _C_int
//sys Fstat(fd int, stat *Stat_t) (err error)
-//fstat64(fd _C_int, stat *Stat_t) _C_int
+//fstat(fd _C_int, stat *Stat_t) _C_int
//sys Ftruncate(fd int, length int64) (err error)
-//ftruncate64(fd _C_int, length Offset_t) _C_int
+//ftruncate(fd _C_int, length Offset_t) _C_int
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
-//getrlimit64(resource _C_int, rlim *Rlimit) _C_int
+//getrlimit(resource _C_int, rlim *Rlimit) _C_int
//sys Lstat(path string, stat *Stat_t) (err error)
-//lstat64(path *byte, stat *Stat_t) _C_int
+//lstat(path *byte, stat *Stat_t) _C_int
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
+//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//__go_open64(path *byte, mode _C_int, perm Mode_t) _C_int
+//__go_open(path *byte, mode _C_int, perm Mode_t) _C_int
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//pwrite64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pwrite(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
//sys Seek(fd int, offset int64, whence int) (off int64, err error)
-//lseek64(fd _C_int, offset Offset_t, whence _C_int) Offset_t
+//lseek(fd _C_int, offset Offset_t, whence _C_int) Offset_t
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
-//setrlimit64(resource int, rlim *Rlimit) _C_int
+//setrlimit(resource int, rlim *Rlimit) _C_int
//sys Stat(path string, stat *Stat_t) (err error)
-//stat64(path *byte, stat *Stat_t) _C_int
+//stat(path *byte, stat *Stat_t) _C_int
//sys Truncate(path string, length int64) (err error)
-//truncate64(path *byte, length Offset_t) _C_int
+//truncate(path *byte, length Offset_t) _C_int
diff --git a/libgo/runtime/go-varargs.c b/libgo/runtime/go-varargs.c
index f84860891e6..7efc9615985 100644
--- a/libgo/runtime/go-varargs.c
+++ b/libgo/runtime/go-varargs.c
@@ -84,7 +84,7 @@ __go_ioctl_ptr (int d, int request, void *arg)
int
__go_open64 (char *path, int mode, mode_t perm)
{
- return open64 (path, mode, perm);
+ return open (path, mode, perm);
}
#endif
diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
index 180f5c31d74..1d717d55c0e 100644
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -366,7 +366,7 @@ typedef loff_t libgo_loff_t_type;
#endif
#if defined(HAVE_OFF64_T)
-typedef off64_t libgo_off_t_type;
+typedef off_t libgo_off_t_type;
#else
typedef off_t libgo_off_t_type;
#endif
@@ -398,13 +398,11 @@ typedef off_t libgo_off_t_type;
// From dirent.h
SREF(dirent);
-SREF(dirent64);
OTREF(DIR);
EREF(DT_UNKNOWN);
// From fcntl.h
SREF(flock);
-SREF(flock64);
// From ffi headers
SREF(_ffi_type);
@@ -485,11 +483,10 @@ EREF(SS_ONSTACK);
EREF(SEGV_MAPERR);
// From stat.h
-SREF(stat64);
+SREF(stat);
// From statfs.h
SREF(statfs);
-SREF(statfs64);
// From sysinfo.h
SREF(sysinfo);
@@ -519,7 +516,7 @@ EREF(PTRACE_PEEKTEXT);
// From sys/resource.h
SREF(rusage);
-SREF(rlimit64);
+SREF(rlimit);
EREF(RLIMIT_NOFILE);
EREF(PRIO_USER);
EREF(RUSAGE_SELF);
--
2.50.1
@@ -1,32 +0,0 @@
From 0e09546330c7500b0d6d4e6d4bbf4fe751d57c34 Mon Sep 17 00:00:00 2001
From: Jingyun Hua <huajingyun@loongson.cn>
Date: Mon, 7 Aug 2023 15:25:58 +0800
Subject: [PATCH] loongarch disable multilib support
Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
---
gcc/config/loongarch/t-linux | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux
index 45862048abf..73155acd832 100644
--- a/gcc/config/loongarch/t-linux
+++ b/gcc/config/loongarch/t-linux
@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32)
MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf)
# Don't define MULTILIB_OSDIRNAMES if multilib is disabled.
-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),)
-
- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default))
- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d)
- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f)
- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s)
-
-endif
+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib
+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib
+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib
--
2.50.1
@@ -1,113 +0,0 @@
From 05b462e0a6de90c0d69a48ed9c58a6f76158344e Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 25 Jul 2025 02:41:46 -0700
Subject: [PATCH] static PIE: ensure -static reaches the linker
on some targets, the logic for the compiler option -static seems not
to be processed when -pie is present. rather than playing
whack-a-mole, just ensure LD_PIE_SPEC specs always pass -static to ld
if either -static or -static-pie is present on the compiler driver
command line.
this may produce redundant -static arguments but it doesn't matter.
---
gcc/common.opt | 4 ++--
gcc/config/gnu-user.h | 17 ++++++++---------
gcc/gcc.cc | 6 +++---
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index e65a575d9f8..7ad38711f6e 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3968,11 +3968,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 0426efdb8c3..866c8bd77f2 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index e9f78f0f4c1..767ff65f348 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1056,7 +1056,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1080,12 +1080,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC
--
2.50.1
@@ -1,77 +0,0 @@
From 4c8cc9a8621b91f8aa83d8ca81f22b00a98d9fa9 Mon Sep 17 00:00:00 2001
From: Andrew Pinski <quic_apinski@quicinc.com>
Date: Fri, 28 Mar 2025 17:25:56 -0700
Subject: [PATCH] except: Don't use the cached value of the gcc_except_table
section for comdat functions [PR119507]
This has been broken since GCC started to put the comdat functions' gcc_except_table into their
own section; r0-118218-g3e6011cfebedfb. What would happen is after a non-comdat function is processed,
the cached value would always be used even for comdat function. Instead we should create a new
section for comdat functions.
OK? Bootstrapped and tested on x86_64-linux-gnu.
PR middle-end/119507
gcc/ChangeLog:
* except.cc (switch_to_exception_section): Don't use the cached section if
the current function is in comdat.
gcc/testsuite/ChangeLog:
* g++.dg/eh/pr119507.C: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
gcc/except.cc | 9 ++++++++-
gcc/testsuite/g++.dg/eh/pr119507.C | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/eh/pr119507.C
diff --git a/gcc/except.cc b/gcc/except.cc
index 205811c6567..0fe1e093489 100644
--- a/gcc/except.cc
+++ b/gcc/except.cc
@@ -2949,7 +2949,14 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname))
{
section *s;
- if (exception_section)
+ if (exception_section
+ /* Don't use the cached section for comdat if it will be different. */
+#ifdef HAVE_LD_EH_GC_SECTIONS
+ && !(targetm_common.have_named_sections
+ && DECL_COMDAT_GROUP (current_function_decl)
+ && HAVE_COMDAT_GROUP)
+#endif
+ )
s = exception_section;
else
{
diff --git a/gcc/testsuite/g++.dg/eh/pr119507.C b/gcc/testsuite/g++.dg/eh/pr119507.C
new file mode 100644
index 00000000000..50afa75a43f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/pr119507.C
@@ -0,0 +1,17 @@
+// { dg-do compile { target comdat_group } }
+// Force off function sections
+// Force on exceptions
+// { dg-options "-fno-function-sections -fexceptions" }
+// PR middle-end/119507
+
+
+inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; }
+int another_func_with_exception() { try { throw 1; } catch (int) { return 1; } return 0; }
+inline int comdat1() { try { throw 1; } catch (int) { return 1; } return 0; }
+int foo() { return comdat() + comdat1(); }
+
+// Make sure the gcc puts the exception table for both comdat and comdat1 in their own section
+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z6comdatv" 1 } }
+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z7comdat1v" 1 } }
+// There should be 3 exception tables,
+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table" 3 } }
--
2.50.1
@@ -1,164 +0,0 @@
From a6c08fc7fe3a144ebd767cd52fe22043947655e9 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Sat, 26 Jul 2025 02:59:45 -0700
Subject: [PATCH] ada: libgnat: use stub symbolic module name functions
The "linux" implementation depends on glibc internals and accordingly
does not work on musl.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/Makefile.rtl | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index cb41e6887cd..152ba70db4d 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1642,7 +1642,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 \
@@ -2014,7 +2014,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-s390.ads
ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
@@ -2359,7 +2359,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(GNATRTL_128BIT_PAIRS) \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
@@ -2407,7 +2407,7 @@ ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-mips.ads
ifeq ($(strip $(filter-out mips64% mipsisa64%,$(target_cpu))),)
@@ -2463,7 +2463,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
@@ -2519,7 +2519,7 @@ ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(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-arm.ads
@@ -2565,7 +2565,7 @@ ifeq ($(strip $(filter-out aarch64% 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) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2607,7 +2607,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
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 \
system.ads<libgnat/system-linux-sparc.ads
ifeq ($(strip $(filter-out sparc64 sparcv9,$(target_cpu))),)
@@ -2660,7 +2660,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-hppa.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2697,7 +2697,7 @@ ifeq ($(strip $(filter-out m68k% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-m68k.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2734,7 +2734,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-sh4.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-linux.adb
@@ -2779,7 +2779,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) \
@@ -2859,7 +2859,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.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) \
@@ -2904,7 +2904,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) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -2956,7 +2956,7 @@ ifeq ($(strip $(filter-out %x32 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) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -3000,7 +3000,7 @@ ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-riscv.ads
ifeq ($(strip $(filter-out riscv64,$(target_cpu))),)
--
2.50.1
@@ -1,26 +0,0 @@
From 4b5dfaaa043999f353ade7fc09e7f1bb4a6fe6db Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Sat, 26 Jul 2025 03:02:38 -0700
Subject: [PATCH] ada: libgnat: recognize linux-musleabi and linux-muslgnueabi
platforms for ARM
---
gcc/ada/Makefile.rtl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 152ba70db4d..89574cdfba7 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2500,7 +2500,7 @@ endif
# ARM linux, GNU eabi
ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
-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))),)
SELECTED_PAIRS=arm-linux-gnueabi
--
2.50.1
-801
View File
@@ -1,801 +0,0 @@
# Automatically generated aport, do not edit!
# Generator: pmbootstrap aportgen gcc-armhf
# Based on: main/gcc (from Alpine)
CTARGET_ARCH=armhf
CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})"
LANG_D=false
LANG_OBJC=false
LANG_JAVA=false
LANG_GO=false
LANG_FORTRAN=false
LANG_ADA=false
options="!strip"
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
# when this variable matches "no*"
BOOTSTRAP="nobuildbase"
# abuild will only cross compile when this variable is set, but it
# needs to find a valid package database in there for dependency
# resolving, so we set it to /.
CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-armhf
pkgver=15.2.0
# i.e. 13.2.1, must match gcc/BASE-VER
_pkgbase="${pkgver%%_git*}"
# date component from snapshots
_pkgsnap="${pkgver##*_git}"
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-armhf
pkgrel=2
pkgdesc="Stage2 cross-compiler for armhf"
url="https://gcc.gnu.org"
arch="x86_64"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
_gccrel=$pkgver-r$pkgrel
depends="binutils-armhf mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1"
makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf"
subpackages="g++-armhf:gpp libstdc++-dev-armhf:libcxx_dev"
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-gdb gcc-doc"
replaces="libstdc++ binutils"
options="!strip !tracedeps"
: "${LANG_CXX:=true}"
: "${LANG_D:=true}"
: "${LANG_OBJC:=true}"
: "${LANG_GO:=true}"
: "${LANG_FORTRAN:=true}"
: "${LANG_ADA:=true}"
: "${LANG_JIT:=true}"
_libgomp=true
_libgcc=false
_libatomic=true
_libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
else
_builddir="$srcdir/build-cross-final"
fi
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_JIT=false
_libgomp=false
_libatomic=false
_libitm=false
# format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431
CPPFLAGS="${CPPFLAGS/-Werror=format-security/}"
# reset target flags (should be set in crosscreate abuild)
# fixup flags. seems gcc treats CPPFLAGS as global without
# _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
export CFLAGS="$CPPFLAGS -g0 ${CFLAGS/-Werror=format-security/}"
export CXXFLAGS="$CPPFLAGS -g0 ${CXXFLAGS/-Werror=format-security/}"
unset CPPFLAGS
export CFLAGS_FOR_TARGET=" "
export CXXFLAGS_FOR_TARGET=" "
export LDFLAGS_FOR_TARGET=" "
STRIP_FOR_TARGET="$CTARGET-strip"
elif [ "$CBUILD" != "$CHOST" ]; then
# format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431
CPPFLAGS="${CPPFLAGS/-Werror=format-security/}"
# fixup flags. seems gcc treats CPPFLAGS as global without
# _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
export CFLAGS="$CPPFLAGS -g0 ${CFLAGS/-Werror=format-security/}"
export CXXFLAGS="$CPPFLAGS -g0 ${CXXFLAGS/-Werror=format-security/}"
unset CPPFLAGS
# reset flags and cc for build
export CC_FOR_BUILD="gcc"
export CXX_FOR_BUILD="g++"
export CFLAGS_FOR_BUILD=" "
export CXXFLAGS_FOR_BUILD=" "
export LDFLAGS_FOR_BUILD=" "
export CFLAGS_FOR_TARGET=" "
export CXXFLAGS_FOR_TARGET=" "
export LDFLAGS_FOR_TARGET=" "
# Languages that do not need bootstrapping
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
_builddir="$srcdir/build-cross-native"
else
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
_builddir="$srcdir/build"
# format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431
CPPFLAGS="${CPPFLAGS/-Werror=format-security/}"
# pass -g0 by default to bypass -g, since we don't do debug
# if -dbg added, the -g is appended and overrides this
export CFLAGS="$CPPFLAGS -g0 ${CFLAGS/-Werror=format-security/} -O2"
export CXXFLAGS="$CPPFLAGS -g0 ${CXXFLAGS/-Werror=format-security/} -O2"
unset CPPFLAGS
# https://gcc.gnu.org/install/build.html
export CFLAGS_FOR_TARGET="$CFLAGS"
export CXXFLAGS_FOR_TARGET="$CXXFLAGS"
export LDFLAGS_FOR_TARGET="$LDFLAGS"
export BOOT_CFLAGS="$CFLAGS"
export BOOT_LDFLAGS="$LDFLAGS"
fi
case "$CTARGET_ARCH" in
# GDC hasn't been ported to PowerPC (LIBDRUNTIME_ONLY=yes)
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc*|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
armhf|armv7|x86) LANG_D=false ;;
esac
# libitm has TEXTRELs in ARM build, so disable for now
case "$CTARGET_ARCH" in
arm*) _libitm=false ;;
mips*) _libitm=false ;;
riscv64) _libitm=false ;;
loongarch64) _libitm=false ;;
esac
# Internal libffi fails to build on MIPS at the moment, need to
# investigate further. We disable LANG_GO on mips64 as it requires
# the internal libffi.
case "$CTARGET_ARCH" in
mips*) LANG_GO=false ;;
loongarch64) LANG_GO=false ;;
esac
# Fortran uses libquadmath if toolchain has __float128
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64 | ppc64le) ;;
*) _libquadmath=false ;;
esac
# libatomic is a dependency for openvswitch
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $_libgomp; then
depends="$depends libgomp=$_gccrel"
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
_languages=c
if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gdc-bootstrap"
subpackages="$subpackages libgphobos::$CTARGET_ARCH"
else
# shared libgphobos is for D programs to link against, so
# skip building that while cross-compiling the GDC compiler
makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross"
fi
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
_languages="$_languages,objc"
fi
if $LANG_GO; then
subpackages="$subpackages libgo::$CTARGET_ARCH gcc-go$_target:go"
_languages="$_languages,go"
fi
if $LANG_FORTRAN; then
subpackages="$subpackages libgfortran::$CTARGET_ARCH gfortran$_target:gfortran"
_languages="$_languages,fortran"
fi
if $LANG_ADA; then
subpackages="$subpackages gcc-gnat$_target:gnat libgnat::$CTARGET_ARCH"
_languages="$_languages,ada"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gnat-bootstrap"
subpackages="$subpackages libgnat-static:libgnatstatic:$CTARGET_ARCH"
else
makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross"
fi
fi
if $LANG_JIT; then
subpackages="$subpackages libgccjit:jit libgccjit-dev:jitdev"
fi
# when using upstream releases, use this URI template
# https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
#
# right now, we are using a git snapshot. snapshots are taken from gcc.gnu.org/pub/gcc/snapshots.
# However, since they are periodically deleted from the GCC mirrors the utilized snapshots are
# mirrored on dev.alpinelinux.org. Please ensure that the snapshot Git commit (as stated in the
# README) matches the base commit on the version-specific branch in the Git repository below.
#
# 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://gcc.gnu.org/pub/gcc/snapshots/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz"
source="https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-specs-turn-on-Wl-z-now-by-default.patch
0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0006-Enable-Wformat-and-Wformat-security-by-default.patch
0007-Enable-Wtrampolines-by-default.patch
0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch
0009-gcc-params-set-default-ssp-buffer-size-to-4.patch
0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0012-libiberty-copy-PIC-objects-during-build-process.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-ada-fix-shared-linking.patch
0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0017-add-fortify-headers-paths.patch
0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0020-aarch64-disable-multilib-support.patch
0021-s390x-disable-multilib-support.patch
0022-ppc64-le-disable-multilib-support.patch
0023-x86_64-disable-multilib-support.patch
0024-riscv-disable-multilib-support.patch
0025-always-build-libgcc_eh.a.patch
0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch
0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch
0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch
0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0030-configure-fix-detection-of-atomic-builtins-in-libato.patch
0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0032-gdc-unconditionally-link-libgphobos-against-libucont.patch
0033-druntime-link-against-libucontext-on-all-platforms.patch
0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
0035-libphobos-do-not-use-LFS64-symbols.patch
0036-libgo-fix-lfs64-use.patch
0037-loongarch-disable-multilib-support.patch
0038-static-PIE-ensure-static-reaches-the-linker.patch
0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch
0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch
0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch
0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch
"
# secfixes:
# 13.2.1_git20231014-r0:
# - CVE-2023-4039
# we build out-of-tree
#builddir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
builddir="$srcdir"/gcc-$_pkgbase
_gcclibdir="usr/lib/gcc/$CTARGET/$_pkgbase"
_gcclibexec="usr/libexec/gcc/$CTARGET/$_pkgbase"
prepare() {
default_prepare
echo $_pkgbase > gcc/BASE-VER
}
build() {
local _arch_configure=
local _bootstrap_configure=
local _jit_configure=
local _sanitizer_configure=
case "$CTARGET" in
aarch64-*-*-*) _arch_configure="--with-arch=armv8-a --with-abi=lp64";;
armv5-*-*-*eabi) _arch_configure="--with-arch=armv5te --with-tune=arm926ej-s --with-float=soft --with-abi=aapcs-linux";;
armv6-*-*-*eabihf) _arch_configure="--with-arch=armv6kz --with-tune=arm1176jzf-s --with-fpu=vfpv2 --with-float=hard --with-abi=aapcs-linux";;
armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";;
mips-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";;
mips64-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";;
mips64el-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";;
mipsel-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";;
powerpc-*-*-*) _arch_configure="--enable-secureplt --enable-decimal-float=no";;
powerpc64*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no --enable-targets=powerpcle-linux";;
i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";;
i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
loongarch64-*-*-*) _arch_configure="--with-arch=la64v1.0 --with-abi=lp64d";;
esac
case "$CTARGET_ARCH" in
*) _sanitizer_configure="--disable-libsanitizer" ;;
esac
case "$CTARGET_ARCH" in
mips*) _hash_style_configure="--with-linker-hash-style=sysv" ;;
*) _hash_style_configure="--with-linker-hash-style=gnu" ;;
esac
export libat_cv_have_ifunc=no
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*)
# cross-bootstrap GDC with a static libphobos: due to GCC's
# ./configure not having a --disable-shared=libphobos option,
# we have to use --enable-shared with everything else instead.
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
_bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath"
else
_bootstrap_configure="--enable-shared"
fi
_bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls"
;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
echo " CBUILD=$CBUILD"
echo " CHOST=$CHOST"
echo " CTARGET=$CTARGET"
echo " CTARGET_ARCH=$CTARGET_ARCH"
echo " languages=$_languages"
echo " arch_configure=$_arch_configure"
echo " cross_configure=$_cross_configure"
echo " bootstrap_configure=$_bootstrap_configure"
echo " hash_style_configure=$_hash_style_configure"
echo ""
local version="Alpine $pkgver"
local gccconfiguration="
--prefix=/usr
--mandir=/usr/share/man
--infodir=/usr/share/info
--build=$CBUILD
--host=$CHOST
--target=$CTARGET
--enable-checking=release
--disable-cet
--disable-fixed-point
--disable-libstdcxx-pch
--disable-multilib
--disable-nls
--disable-werror
--disable-symvers
--enable-__cxa_atexit
--enable-default-pie
--enable-default-ssp
--enable-languages=$_languages
--enable-link-serialization=2
--enable-linker-build-id
$_arch_configure
--disable-libssp
$_sanitizer_configure
$_cross_configure
$_bootstrap_configure
--with-bugurl=https://gitlab.alpinelinux.org/alpine/aports/-/issues
--with-system-zlib
$_hash_style_configure
"
mkdir -p "$_builddir"
cd "$_builddir"
"$builddir"/configure $gccconfiguration \
--with-pkgversion="$version"
msg "building gcc"
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
# cross-compiling libphobos with parallel make fails
make all-target-libphobos
fi
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
# as doing so slows it down a few %, so for some quick if's here we gain
# free performance
if $LANG_JIT; then
mkdir -p "$_builddir"/libgccjit-build
cd "$_builddir"/libgccjit-build
"$builddir"/configure $gccconfiguration \
--disable-bootstrap \
--enable-host-shared \
--enable-languages=jit \
--with-pkgversion="$version"
msg "building libgccjit"
make all-gcc
fi
}
package() {
cd "$_builddir"
make -j1 DESTDIR="$pkgdir" install
[ "$CHOST" = "$CTARGET" ] && ln -s gcc "$pkgdir"/usr/bin/cc
ln -s ${CTARGET}-gcc "$pkgdir"/usr/bin/${CTARGET}-cc
# symlink to vendor-less target triple for
# supporting clang --target's fallback match
# ref: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16828
ln -s "$CTARGET" "$pkgdir/usr/lib/gcc/${CTARGET%%-*}-${CTARGET#*-*-}"
if $LANG_JIT; then
make -C "$_builddir"/libgccjit-build/gcc DESTDIR="$pkgdir" jit.install-common
fi
# we dont support gcj -static
# and saving 35MB is not bad.
find "$pkgdir" \( -name libgtkpeer.a \
-o -name libgjsmalsa.a \
-o -name libgij.a \) \
-delete
# 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 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 {} +
if $_libgomp; then
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
fi
if $_libitm; then
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
fi
# remove ffi
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
find "$pkgdir" -name 'ffi*.h' -delete
local gdblib=${_target:+$CTARGET/}lib
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
done
fi
# move ada runtime libs
if $LANG_ADA; then
local libgnat_static=
[ "$CHOST" = "$CTARGET" ] && libgnat_static="libgna*.a"
for i in $(find "$pkgdir"/$_gcclibdir/adalib/ -type f -maxdepth 1 \( -name "libgna*.so" -o -name "$libgnat_static" \) ); do
mv "$i" "$pkgdir"/usr/lib/
ln -s ../../../../${i##*/} $i
done
fi
if [ "$CHOST" != "$CTARGET" ]; then
# cross-gcc: remove any files that would conflict with the
# native gcc package
rm -rf "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
# libcc1 does not depend on target, don't ship it
rm -rf "$pkgdir"/usr/lib/libcc1.so*
# fixup gcc library symlinks to be linker scripts so
# linker finds the libs from relocated sysroot
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
if [ -h "$so" ]; then
local _real=$(basename "$(readlink "$so")")
rm -f "$so"
echo "GROUP ($_real)" > "$so"
fi
done
else
# add c89/c99 wrapper scripts
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
#!/bin/sh
_flavor="-std=c89"
for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
EOF
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
#!/bin/sh
_flavor="-std=c99"
for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) _flavor="";;
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
EOF
chmod 755 "$pkgdir"/usr/bin/c?9
# install lto plugin so regular binutils may use it
mkdir -p "$pkgdir"/usr/lib/bfd-plugins
ln -s /$_gcclibexec/liblto_plugin.so "$pkgdir/usr/lib/bfd-plugins/"
fi
}
libatomic() {
pkgdesc="GCC Atomic library"
depends=
replaces="gcc"
amove usr/lib/libatomic.so.*
}
libcxx() {
pkgdesc="GNU C++ standard runtime library"
depends=
if [ "$CHOST" = "$CTARGET" ]; then
# verify that we are using clock_gettime rather than doing direct syscalls
# so we dont break 32 bit arches due to time64.
nm -D "$pkgdir"/usr/lib/libstdc++.so.* | grep clock_gettime
fi
amove usr/lib/libstdc++.so.*
}
libcxx_dev() {
pkgdesc="GNU C++ standard runtime library (development files)"
depends=
replaces="g++"
amove usr/${_target:+$CTARGET/}lib/libstdc++.a \
usr/${_target:+$CTARGET/}lib/libstdc++exp.a \
usr/${_target:+$CTARGET/}lib/libstdc++.so \
usr/${_target:+$CTARGET/}lib/libstdc++fs.a \
usr/${_target:+$CTARGET/}lib/libsupc++.a \
usr/${_target:+$CTARGET/}include/c++
}
gpp() {
pkgdesc="GNU C++ standard library and compiler"
depends="libstdc++-dev$_target=$_gccrel gcc$_target=$_gccrel musl-dev"
[ "$CHOST" = "$CTARGET" ] && depends="$depends libstdc++=$_gccrel"
depends="$depends so:libc.musl-x86_64.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libz.so.1"
amove $_gcclibexec/cc1plus
amove usr/bin/*++
}
jit() {
pkgdesc="GCC JIT Library"
depends=
amove usr/lib/libgccjit.so*
}
jitdev() {
pkgdesc="GCC JIT Library (development files)"
depends="libgccjit"
amove usr/include/libgccjit*.h
}
libobjc() {
pkgdesc="GNU Objective-C runtime"
replaces="objc"
depends=
amove usr/lib/libobjc.so.*
}
objc() {
pkgdesc="GNU Objective-C"
replaces="gcc"
depends="musl-dev gcc=$_gccrel libobjc=$_gccrel"
amove $_gcclibexec/cc1obj
amove $_gcclibdir/include/objc
amove usr/lib/libobjc.so
amove usr/lib/libobjc.a
}
libgcc() {
pkgdesc="GNU C compiler runtime libraries"
depends=
amove usr/lib/libgcc_s.so.*
}
libgomp() {
pkgdesc="GCC shared-memory parallel programming API library"
depends=
replaces="gcc"
amove usr/lib/libgomp.so.*
}
libgphobos() {
pkgdesc="D programming language standard library for GCC"
depends=
amove usr/lib/libgdruntime.so.*
amove usr/lib/libgphobos.so.*
}
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc$_target=$_gccrel musl-dev libucontext-dev"
[ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel"
# Copy: The installed '.d' files, the static lib, the binary itself
# The shared libs are part of 'libgphobos' so one can run program
# without installing the compiler
amove $_gcclibexec/d21
amove $_gcclibdir/include/d
if [ "$CBUILD" = "$CTARGET" ]; then
amove usr/lib/libgdruntime.so
amove usr/lib/libgphobos.so
fi
amove usr/${_target:+$CTARGET/}lib/libgdruntime.a
amove usr/${_target:+$CTARGET/}lib/libgphobos.a
amove usr/${_target:+$CTARGET/}lib/libgphobos.spec
amove usr/bin/*gdc
}
libgo() {
pkgdesc="Go runtime library for GCC"
depends=
amove usr/lib/libgo.so.*
}
go() {
pkgdesc="GCC Go frontend (intended for bootstrapping community/go)"
depends="gcc=$_gccrel libgo=$_gccrel !go"
amove usr/lib/go
amove usr/bin/*go
amove usr/bin/*gofmt
amove $_gcclibexec/go1
amove $_gcclibexec/cgo
amove $_gcclibexec/buildid
amove $_gcclibexec/test2json
amove $_gcclibexec/vet
amove usr/lib/libgo.a
amove usr/lib/libgo.so
amove usr/lib/libgobegin.a
amove usr/lib/libgolibbegin.a
}
libgfortran() {
pkgdesc="Fortran runtime library for GCC"
depends=
amove usr/lib/libgfortran.so.*
}
libquadmath() {
replaces="gcc"
pkgdesc="128-bit math library for GCC"
depends=
amove usr/lib/libquadmath.so.*
}
gfortran() {
pkgdesc="GNU Fortran Compiler"
depends="gcc=$_gccrel libgfortran=$_gccrel"
$_libquadmath && depends="$depends libquadmath=$_gccrel"
replaces="gcc"
amove usr/bin/*gfortran
amove usr/lib/libgfortran.a
amove usr/lib/libgfortran.so
if $_libquadmath; then
amove usr/lib/libquadmath.a
amove usr/lib/libquadmath.so
fi
amove $_gcclibdir/finclude
amove $_gcclibexec/f951
mv -v "$pkgdir"/usr/lib/libgfortran.spec "$subpkgdir"/$_gcclibdir/
}
libgnat() {
pkgdesc="GNU Ada runtime shared libraries"
depends=
amove usr/lib/libgna*.so
}
libgnatstatic() {
pkgdesc="GNU Ada static libraries"
depends=
amove usr/lib/libgna*.a
}
gnat() {
pkgdesc="Ada support for GCC"
depends="gcc=$_gccrel"
provides="$pkgname-gnat-bootstrap=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
amove $_gcclibexec/*gnat*
amove $_gcclibdir/*ada*
amove usr/bin/*gnat*
}
gdb() {
pkgdesc="$pkgdesc (gdb printers)"
install_if="$pkgname=$pkgver-r$pkgrel gdb"
amove \
usr/share/gdb/python/ \
usr/share/gcc-*/python/
}
sha512sums="
89047a2e07bd9da265b507b516ed3635adb17491c7f4f67cf090f0bd5b3fc7f2ee6e4cc4008beef7ca884b6b71dffe2bb652b21f01a702e17b468cca2d10b2de gcc-15.2.0.tar.xz
fd5cebc5deb1d588583424acbc1b5a6d8d6f5b1bfa9f4bdbc082cfd406723f423d87011ee30e04ed18128a7ed8021cbfc9262becff5419125dc1afb6f407defa 0001-posix_memalign.patch
6634004cb9feea9ee0d063d6b6984d7db3b10c692b6139bb99169a4f2d74f0e10b5ca0ab31ce346ffef34b8eb9c3f536aa4d94bce1b27f8e0b8a9fc5cc4b7057 0002-gcc-poison-system-directories.patch
37e089791dbcbad73af866b662cda611dc0970d93e28251c7a9aa898db3b96446654e8b778d7866eb8550ba7f4a57cf22e8514d562bfed0c66613e65550d9c85 0003-specs-turn-on-Wl-z-now-by-default.patch
d4d5bfeb20a9fac968f37497d86d7eff4a9ac863e015dadbffae24c08236f5efde69b615d95191e2546672ce2d4b30d3627528c64a83fc64b715e8fa6fd4c372 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
4806687c806154dd3d5423ea9ef1203db344dfb8fd21f3eb3543d9f05f4dc01aacc4f012f45db8e890eeddc7b1c75ec06a6b29e29a1ef7b9ec6f853d1854cfd0 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
6b225df0dd76339b06d5efbe07edd6648391a7b9415a219041189c35c084ceffe8fb96b2660d60d62099e7afdfeb8e053622a2b6660d2e8a13adb924f4bc8c8a 0006-Enable-Wformat-and-Wformat-security-by-default.patch
e419b7f20a74384bfb1ac792e3625f9bfe69f8031c2c0beb23f4015df9d48a6c6f107d89bea3c20fa56309b022637863c13e90c1565d027eb47c08154389b7a0 0007-Enable-Wtrampolines-by-default.patch
e6307eec09196900bcd2c0154a62d6694576b4da48a1cf901750b97b4603cd694c4daee2476c33bce09f10bee92a72749face835eb18fbf2c2a50aa1dd251572 0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch
969797f99602c119e1632f0c5be02a566be5fb4c7e59affefb5eb6084a06b97120d99d5ee63fef0dab6c0278c7cecf1d8caa53521cc5b6622de2aaa7deabf86e 0009-gcc-params-set-default-ssp-buffer-size-to-4.patch
c15f062790367c9e786a4933deec33931438680176ec752b172c2a0504463a23d588ead4350d32e474603750ceb130ba0ccadfcde601bcf8e2eabca5af8322d0 0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
03a1012f1022cd68cf08440428e7d6cbf65ea2184e4a088a55976f34af627d80f42f15f713841ec9cbfc4afa39117d4fc384c3f27a4f9ad0ff3947bd45b71c4a 0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch
8f098de9fcf4bbece0923dc4a2acfc67cf751c1d5c007535c5d88b8637a4482c1a42d5721a2760127498e327f6983bbc865a592a8e0db9ef7efc0e36b6d4102f 0012-libiberty-copy-PIC-objects-during-build-process.patch
bbe2b561b5288ca724af37353e17b413df8bf247bce724391e75373aee5cdcdb85e6489d51622c11f4041ed8f317278cf687aee14dfc8756398f03f1a796feb9 0013-libgcc_s.patch
ae34ca2bc5a53ed1c832651e3f6425ca29b5873f1e112b45613277fb9611693be41986d5879593f09149777e3e57d04ba17b142c43eaa990375d31e4e0b4adde 0014-nopie.patch
2c91a1eadf7236efff42eb53037862a342807596e37c6cc3c270d25c2d89078bf8db68bb2e93e57a8ad39b3af825e33db72e2f48a6311951fff53776933bc48c 0015-ada-fix-shared-linking.patch
1366d696a952ed35e5e56ab5bd1eba67e58a8ce752c0ef7e7fe4ad3eef44f25ce6016342d11add9548f9e719dc9ee0772064dda68784257a1a3234ae5957f3fb 0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
af739373285e89a4ab0000042b537ff7197b0b366019b56991008c43f3d2b76709d472841cda40e9fb61e6f0dacc0fe8c6b888abb31f393ec1a87acc1c0585b3 0017-add-fortify-headers-paths.patch
c18f3eef4d7d6fcbfa64570edb71157a62dad1f3d7276f10fe3424e49caa33f57a0a5952f03189199472802a2dd966e4832789685a94911fe9a86bb1fd6c1d50 0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
341d39a40ffd896db152863c717798c6885bdde44c9ac645c5d099c2364cbd8f6f526f97cc98302c420682cb5d6d88bbe28d838c7141456f2ba5581f3edfd64f 0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
e603652f341909820789a2cec173b8e547ee607b040863f1745b998b8a69d51cb412a4ac55d2c9e3c5192cc298f6288f9dd48fa06fe53ba8f6b1cabbe61c997a 0020-aarch64-disable-multilib-support.patch
26819f3c3a5844c96cee89fc9766a4f8153e7bb22f6296c6c9fd6a13d45648e3f6c7059397ad7e5be66f55addc21054614b38f480b52a7c9a967cf389735644a 0021-s390x-disable-multilib-support.patch
8e6e6ed84c8cb39ecc35ad0986a91168fedbae2426c8ec1c83dec85a293777e0ec29eac13130193b1bdc2d98b6ffa180abf574dad70740d4720b4bfdab992ab8 0022-ppc64-le-disable-multilib-support.patch
264eaa54a76ec5a12294d91ad2f995eddac9210a569ba85aef27176cb015354aa427840bb22f1e3ba2f7761f6f85cc98ddb3b00584b295c6a10a9770c59a2607 0023-x86_64-disable-multilib-support.patch
47a1a407298b6c259d7faff774f26e4843c9d3764362d74230e7d3f77c46ea8bb51211e09a66bb51c04a9f276ea5b07570fb52312fdb1d354c72a0343bc40c57 0024-riscv-disable-multilib-support.patch
b86fcf40e75861bdffb00069d3a0c9cec3fe8042d49d6ce2beae48ffeadccc576b8ab36e5a85421db5cffeb080a75f3a66dbcbb825d7f4462d40ec621964efe3 0025-always-build-libgcc_eh.a.patch
1425543ce064bfd8e33d7e6e07f45cc16d94f156adcfe190c842722652d5ea0c9ba60f6a3e1b444bb0e5bc906ec4f9ca54720b306f274b441600b79bff47dc57 0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch
b8851d0e7fc66201e323007f7c1d702ea8a0d0405aa5945621128ebfb93afd967ec8b3ab6fd4ea779ec10dca2a32e1797f7a2622124ccf8ace2a7596f66ff0bf 0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch
12b09a171d61406a2bfa10bb25398cee8c92676b12506afe7aace7028e94cbf8d7df25f62ff7af07e8ed471c6edd3ab7811fa51dfaf3a221a6b367858b1f032c 0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch
15bed06ee74a36e9f21f4b29d7bce9c4188769abb6391560e13ea6b165da51f5ae908e141de7510d3d7eec6b998d0fc53de1042fdb7bd056efa703d230a683b4 0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
4c5501256669fd33527a5394eaa4b84451ee341a943dd24a179b661d3c53ef70e87ed5d5f3e76c6c3f9cb79cb5d120ea40101278a7b9d04a55d9405e4cbf9796 0030-configure-fix-detection-of-atomic-builtins-in-libato.patch
eecc77e2a9cf956fd752693ad7f8ff8253a7bb557e00564bb488bbc1deac895e63104cc1182a0bdd700e440763f4a72e29876f560e13e4f5e6de2a1d9438c2f6 0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
2b09f90d9cb417170060c8ce198bd4aa2e4ef163286c8f24f6e6c5a673ae80f5a883b078b1a5dd5fa71bc1502e08c886687072694da039eb82baa1ea1948ac2c 0032-gdc-unconditionally-link-libgphobos-against-libucont.patch
99c74242b6d79e6a814f1199b9fb0b56c6a43eb93e5d1a79b674cea750bb025363cdd1505d05cd2195a43c918831fa586c427556ee5bc826aa79cd82e7ee1c24 0033-druntime-link-against-libucontext-on-all-platforms.patch
4f8f7876bf8647cda47cbd2b145ff31efe2a7ac21c012c4134174f93482aad1fbab2592c66aacc3b05fccd1a694ff97511b794139db4aac719e243c114373240 0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
0069da1d8cb9adb9bab081a34fec680a9ebb1236e606a2497e4565e99bef434518a0f06474a9a1fdfa70811ed3da5d35ca95d267268328f2764bf41c50e924de 0035-libphobos-do-not-use-LFS64-symbols.patch
1cbe85b63ef13bdf2804bfd3173998a6e86752d8ffc09d4cc75a9ba80b98aec5a04efa732bce97a2f50a90c84b92c442ca8f6639841fe7d6618f928ea65916a6 0036-libgo-fix-lfs64-use.patch
98fcd5b893a1646edab961a5d00246151c47b449f8eca99c51f4026ffdb53f60b5b9f6426437c0a6411342da10db8983e20337a29cd46ed22b70e0478573ea30 0037-loongarch-disable-multilib-support.patch
1ad48e39dab351b7bb3e17d9b4b8b78e7de7c736e212638c9d6874b1dde0360dcfc85586c39f515fbd2a6d9910fedc4f0c6ad7ff652b10a5c288c47173671ec7 0038-static-PIE-ensure-static-reaches-the-linker.patch
9f4c3fa0d17cfcd72626bdbaf51992ff3018f878d673ab19b9056047ee2630b581e5a5a4d4857444f08ba9bcdb0fc94f90dcda6180816e39690d1652843f0d8a 0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
d166475e340c91bbb24cf257240aab37129b04f2609e5ce323b530ab83853a4c34c525e0072c15732717f1681db07e6b3b0a4d268720c31f460435ccf4c99b7f 0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch
c717764ef52c0226a23cbf434654cdefa6cbf38ec625648575d9143c5513b16d8914c25015db743033b8a46ac5b2c33ab75e1b67076128d67bb1319e5a83dd85 0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch
c3b64b05332bd4dd7fad3fff3cacd4f9de0512943f1548c6f1205fab1a74c83622024f30471805f57d625198cc32f647b32172914528fd5605d0bf61cb0c3ff1 0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch
e91873055550eba051d9297bec5c6acd27abb9ee6ce8911cdd04b5faf37d77b6b2a7607ec588d2863f13f14b48af9398cb4ac42443d8567bfa5037dc6bd50404 0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch
"
@@ -1,130 +0,0 @@
From 824eae920f0f64dd7687c969a2436b129161fdc9 Mon Sep 17 00:00:00 2001
From: Jinyang He <hejinyang@loongson.cn>
Date: Wed, 29 Oct 2025 16:07:35 +0800
Subject: [PATCH] LoongArch: Only allow valid binary op when optimize
conditional move
It is wrong that optimize from `if (cond) dest op= 1 << shift` to
`dest op= (cond ? 1 : 0) << shift` when `dest op 0 != dest`.
Like `and`, `mul` or `div`.
And in this optimization `mul` and `div` is optimized to shift.
gcc/ChangeLog:
* config/loongarch/loongarch.cc
(loongarch_expand_conditional_move): Only allow valid binary
op when optimize conditional move.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/conditional-move-opt-1.c: Remove mul.
* gcc.target/loongarch/conditional-move-opt-2.c: Remove and.
* gcc.target/loongarch/conditional-move-opt-3.c: New test.
Co-Authored-By: Peng Fan <fanpeng@loongson.cn>
---
gcc/config/loongarch/loongarch.cc | 26 ++++++++++++++++---
.../loongarch/conditional-move-opt-1.c | 4 +--
.../loongarch/conditional-move-opt-2.c | 2 +-
.../loongarch/conditional-move-opt-3.c | 14 ++++++++++
4 files changed, 40 insertions(+), 6 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index bdf290654..740c8611a 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -5533,12 +5533,32 @@ loongarch_expand_conditional_move (rtx *operands)
}
}
+ auto is_binary_op_0_keep_orig = [](enum rtx_code code)
+ {
+ switch (code)
+ {
+ case PLUS:
+ case MINUS:
+ case IOR:
+ case XOR:
+ case ROTATE:
+ case ROTATERT:
+ case ASHIFT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+ return true;
+ default:
+ return false;
+ }
+ };
+
/* Check if the optimization conditions are met. */
if (value_if_true_insn
&& value_if_false_insn
- /* Make sure that value_if_false and var are the same. */
- && BINARY_P (value_if_true_insn_src
- = SET_SRC (single_set (value_if_true_insn)))
+ /* Make sure that the orig value OP 0 keep orig. */
+ && (value_if_true_insn_src
+ = SET_SRC (single_set (value_if_true_insn)))
+ && is_binary_op_0_keep_orig ( GET_CODE (value_if_true_insn_src))
/* Make sure that both value_if_true and value_if_false
has the same var. */
&& rtx_equal_p (XEXP (value_if_true_insn_src, 0),
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
index ed13471aa..47802aa96 100644
--- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c
@@ -27,7 +27,7 @@ void
test_lt ()
{
if (lm < ln)
- lr *= (1 << 16);
+ lr += (1 << 16);
lr += lm;
}
@@ -35,7 +35,7 @@ void
test_le ()
{
if (lm <= ln)
- lr = lm * ((long)1 << 32);
+ lr = lm + ((long)1 << 32);
else
lr = lm;
lr += lm;
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
index ac72d4d93..743fd5e67 100644
--- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c
@@ -29,7 +29,7 @@ void
test_lez ()
{
if (lm <= 0)
- lr &= (1 << 16);
+ lr |= (1 << 16);
lr += lm;
}
diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
new file mode 100644
index 000000000..95887980c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "maskeqz" } } */
+/* { dg-final { scan-assembler "masknez" } } */
+
+extern long lm, ln, lr;
+
+void
+test_and ()
+{
+ if (lm < 0)
+ lr &= (1 << 16);
+ lr += lm;
+}
--
2.51.1
@@ -1,42 +0,0 @@
From 94cf7d2b3514ed3a4401861a519ead450e022afc 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 d1d79a32fc9..069c3bb8324 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;
--
2.50.1
@@ -1,77 +0,0 @@
From 21b7d08714c4964403848db4144003835ff5245a Mon Sep 17 00:00:00 2001
From: Linsen Zhou <i@lin.moe>
Date: Fri, 17 Oct 2025 11:05:04 +0800
Subject: [PATCH] tree-object-size.cc: Fix assert constant offset in
check_for_plus_in_loops [PR122012]
After commit 51b85dfeb19652bf3e0aaec08828ba7cee1e641c, when the
pointer offset is a variable in the loop, the object size of the
pointer may also need to be reexamined.
Which make gcc_assert in the check_for_plus_in_loops failed.
gcc/ChangeLog:
PR tree-optimization/122012
* tree-object-size.cc (check_for_plus_in_loops): Skip check
for the variable offset
gcc/testsuite/ChangeLog:
PR tree-optimization/122012
* gcc.dg/torture/pr122012.c: New test.
Signed-off-by: Linsen Zhou <i@lin.moe>
(cherry picked from commit 82cefc4898d4ccabe76e28d6626b91ca9e998923)
---
gcc/testsuite/gcc.dg/torture/pr122012.c | 18 ++++++++++++++++++
gcc/tree-object-size.cc | 7 +++----
2 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr122012.c
diff --git a/gcc/testsuite/gcc.dg/torture/pr122012.c b/gcc/testsuite/gcc.dg/torture/pr122012.c
new file mode 100644
index 00000000000..055915a1e98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr122012.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+#include <stdlib.h>
+
+void foo();
+
+void test(size_t step) {
+ char *buf = malloc(64);
+ char *p = buf;
+ size_t i;
+
+ for(i = 0; i < 64; ++i) {
+ p += 4;
+ if (__builtin_object_size (p, 2) != 0)
+ foo();
+ p += step;
+ }
+ free(buf);
+}
diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
index 2d13ab79a84..76dc2446059 100644
--- a/gcc/tree-object-size.cc
+++ b/gcc/tree-object-size.cc
@@ -2153,12 +2153,11 @@ check_for_plus_in_loops (struct object_size_info *osi, tree var)
&& gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
{
tree basevar = gimple_assign_rhs1 (stmt);
- tree cst = gimple_assign_rhs2 (stmt);
-
- gcc_assert (TREE_CODE (cst) == INTEGER_CST);
+ tree offset = gimple_assign_rhs2 (stmt);
/* Skip non-positive offsets. */
- if (integer_zerop (cst) || compare_tree_int (cst, offset_limit) > 0)
+ if (TREE_CODE (offset) != INTEGER_CST
+ || integer_zerop (offset) || compare_tree_int (offset, offset_limit) > 0)
return;
osi->depths[SSA_NAME_VERSION (basevar)] = 1;
--
2.51.0
@@ -1,258 +0,0 @@
From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 23 Jan 2025 17:12:51 -0800
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".
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: sunil dora <sunilkumar.dora@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/common.opt | 4 ++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.cc | 12 ++++++++++--
gcc/incpath.cc | 25 +++++++++++++++++++++++++
7 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index e3fa0dacec4..bea1adc0940 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -729,6 +729,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 a79c51adb2b..8a531ed591c 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -249,6 +249,16 @@
#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#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 16965953f05..0f4a5d52c30 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1051,6 +1051,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_host_pie
@@ -1828,6 +1829,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
--enable-host-pie build host code as PIE
@@ -34027,6 +34030,22 @@ 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}" != "xno"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9f67e62950a..b0e3615e5aa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7502,6 +7502,22 @@ 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 (no/yes/error)]),,
+ [enable_poison_system_directories=no])
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 72009c33cd0..29aea724731 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
+-Wno-poison-system-directories
-Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor
-Wno-psabi
-Wredundant-decls -Wrestrict
@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default.
Suppress warnings from casts from a pointer to an integer type of a
different size.
+@opindex Wno-poison-system-directories
+@item -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.
+
@opindex Winvalid-pch
@opindex Wno-invalid-pch
@item -Winvalid-pch
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4fd87f2c4a1..79d4920a047 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -909,6 +909,12 @@ proper position among the other output files. */
#define ASM_MAP ""
#endif
+#ifdef POISON_BY_DEFAULT
+#define POISON_IS_ERROR " -Werror=poison-system-directories"
+#else
+#define POISON_IS_ERROR
+#endif
+
/* Assembler options for compressed debug sections. */
#if HAVE_LD_COMPRESS_DEBUG == 0
/* Reject if the linker cannot write compressed debug sections. */
@@ -1166,6 +1172,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*} %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
@@ -1268,7 +1276,7 @@ static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
%{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
@@ -1297,7 +1305,7 @@ static const char *cc1_options =
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
- %{pthread:-fprofile-update=prefer-atomic}}}";
+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
static const char *asm_options =
"%{-target-help:%:print-asm-header()} "
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index c1bbfd3872a..2cdbebc4c50 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. */
@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
cur->name, xstrerror (errno));
reason = REASON_NOENT;
}
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ pcur = &cur->next;
+ continue;
+#endif
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
fprintf (stderr, _("End of #embed 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
--
2.50.1
@@ -1,44 +0,0 @@
From 90e8697dd88fd99ce2cf8739e95494853005377e 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 29aea724731..6fb3ab70cc7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -19477,6 +19477,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}.
+
@opindex u
@item -u @var{symbol}
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 79d4920a047..74a356fdf5e 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1170,6 +1170,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} \
--
2.50.1
@@ -1,46 +0,0 @@
From 17c9cf9272077bc7ac784daffd4c68ba1ce67a0d 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 4589ee4a3a6..9edf095384c 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1581,6 +1581,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 6fb3ab70cc7..799ce073dbf 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12840,6 +12840,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}.
+
@opindex O3
@item -O3
Optimize yet more. @option{-O3} turns on all optimizations specified
--
2.50.1
@@ -1,286 +0,0 @@
From 95d8fac6247b2cba1142261cc95c21063539112a 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/loongarch/gnu-user.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 ++++++++++++++++++++--------
15 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 116bb4e69f3..daf99f8dce9 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -39,6 +39,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 3fd3b831166..0b4c2dccebe 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 d4d389e2aa8..adccc0b11c2 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 4c4e31efa39..3c17ac6eade 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 "%{!shared:libhwasan_preinit%O%s} " \
"%{static-libhwasan:%{!shared:" \
@@ -146,12 +146,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 7abfda53049..ceb8f855b7d 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 abe714711bf..3ca128a79f5 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 a2494c214c4..e1a5d530cdf 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/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
index fbc75a90ad5..adbc4b7733f 100644
--- a/gcc/config/loongarch/gnu-user.h
+++ b/gcc/config/loongarch/gnu-user.h
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC \
- "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \
+ "%{G*} %{shared} --as-needed -m " GNU_USER_LINK_EMULATION \
"%{!shared: %{static} " \
"%{!static: %{!static-pie: %{rdynamic:-export-dynamic} " \
"-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} " \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5a82508c113..6eee7cdc603 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 9060c940a44..282c77b6a7b 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -48,6 +48,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} \
-X \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 0316d8cb65d..139e1b6796c 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -378,13 +378,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 afb5c6ad867..b64638fb25b 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -781,7 +781,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 2c3bca5dfcb..b90661247a4 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 6d928846895..3cc05bb7240 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 74a356fdf5e..fc9c7d15b04 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -774,8 +774,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
@@ -810,8 +813,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
@@ -828,8 +834,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
@@ -844,8 +853,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
--
2.50.1
@@ -1,34 +0,0 @@
From 58a94690d4dd7b34543d9d154abc96d2d90d3b32 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 75b6531860e..78830ce4b42 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end
of the destination region.
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
@@ -830,7 +830,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.
Wframe-address
--
2.50.1
@@ -1,25 +0,0 @@
From b2a755b671d88c34402290d7d769232e01aed350 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:44:20 -0700
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 bea1adc0940..e65a575d9f8 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -829,7 +829,7 @@ Common Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wa
Warn if a comparison always evaluates to true or false.
Wtrampolines
-Common Var(warn_trampolines) Warning
+Common Var(warn_trampolines) Init(1) Warning
Warn whenever a trampoline is generated.
Wtrivial-auto-var-init
--
2.50.1
@@ -1,39 +0,0 @@
From c355364231395090e7223ec00d8a16065903c2c5 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:49:03 -0700
Subject: [PATCH] gcc: disable SSP on -ffreestanding, -nostdlib and
-nodefaultlibs
---
gcc/gcc.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fc9c7d15b04..7b0d3d2743b 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1009,6 +1009,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" \
@@ -1314,7 +1320,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|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
--
2.50.1
@@ -1,25 +0,0 @@
From 5f09842c19d6db976724cd117190a8a6951acf9b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:50:42 -0700
Subject: [PATCH] gcc: params: set default ssp-buffer-size to 4
---
gcc/params.opt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/params.opt b/gcc/params.opt
index 64e453d29b7..bba3fd574f2 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1064,7 +1064,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=
--
2.50.1
@@ -1,54 +0,0 @@
From ee0615536ae0d255f59070b904aa35d6de8fce49 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 7f84a99533e..a4c6284f788 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 8e93445acd2..d6ff06e5ddb 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)
--
2.50.1
@@ -1,28 +0,0 @@
From 62966418472466142a9962892177f4b1f9f56944 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 d4e8791b14b..c074980ed80 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -678,8 +678,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. */
--
2.50.1
@@ -1,24 +0,0 @@
From 0351f4f3dd00bdece780ce5e24d972e97ca1b7ed 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 ce54d88278d..10c212a1ad3 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -266,6 +266,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi
--
2.50.1
-57
View File
@@ -1,57 +0,0 @@
From bd7e32d5405b6b4f3994a212a77ff2cd33134c74 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 cdfd94d3c73..a3a6c988833 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -13643,10 +13643,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 2484dc839bf..e980030ef23 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)
--
2.50.1
-85
View File
@@ -1,85 +0,0 @@
From c191dc86f4f7340542066f4156aa57be9cfbf876 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 | 25 +++++++++++++++++++++++++
gcc/configure.ac | 11 +++++++++++
2 files changed, 36 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 0f4a5d52c30..343563c8948 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -34586,6 +34586,29 @@ rm -f core conftest.err conftest.$ac_objext \
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
$as_echo "$gcc_cv_no_pie" >&6; }
+# 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 ${gcc_cv_nopie+:} false; 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 x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -34603,6 +34626,8 @@ if test x$enable_host_pie = xyes; then
LD_PICFLAG=-pie
elif test x$gcc_cv_no_pie = xyes; then
LD_PICFLAG=-no-pie
+elif test x$gcc_cv_nopie = xyes; then
+ LD_PICFLAG=-nopie
else
LD_PICFLAG=
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b0e3615e5aa..b3948469d17 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7802,6 +7802,15 @@ AC_CACHE_CHECK([for -no-pie option],
[gcc_cv_no_pie=yes],
[gcc_cv_no_pie=no])
LDFLAGS="$saved_LDFLAGS"])
+# Check if -nopie works.
+AC_CACHE_CHECK([for -nopie option],
+ [gcc_cv_nopie],
+ [saved_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -nopie"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
+ [gcc_cv_nopie=yes],
+ [gcc_cv_nopie=no])
+ LDFLAGS="$saved_LDFLAGS"])
if test x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -7819,6 +7828,8 @@ if test x$enable_host_pie = xyes; then
LD_PICFLAG=-pie
elif test x$gcc_cv_no_pie = xyes; then
LD_PICFLAG=-no-pie
+elif test x$gcc_cv_nopie = xyes; then
+ LD_PICFLAG=-nopie
else
LD_PICFLAG=
fi
--
2.50.1
@@ -1,42 +0,0 @@
From f1d6c0950e0f12fb8cf2429da570f478a1369286 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 9e3385ca94f..2c0cca6e480 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";
--
2.50.1
@@ -1,24 +0,0 @@
From 8773e0cf880da9fe80de7f8a662359664bb0b234 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 b1ed67d3d4f..1e039c20550 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -179,6 +179,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.
--
2.50.1
@@ -1,25 +0,0 @@
From 625b8095796f24389fdda5bb5bc6ff9fbb365813 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 d6280a4d4dd..ba69fb9fad7 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -159,6 +159,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
--
2.50.1
@@ -1,31 +0,0 @@
From c557286adc46536fe033df400c50a880b672cfd6 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 7b0d3d2743b..e46e976a2e8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1017,8 +1017,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" \
--
2.50.1
@@ -1,69 +0,0 @@
From d698fead9d201ef032e2e978898864335a9ab513 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 e46e976a2e8..607c8ca1d42 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -775,10 +775,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
@@ -814,10 +814,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
@@ -835,10 +835,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
@@ -854,10 +854,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
--
2.50.1
@@ -1,26 +0,0 @@
From 9cf1916bd52d61ea0fd7a8b6acebb1dc4a1f2488 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 70e36b3299e..e00c3becd3f 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)
--
2.50.1
@@ -1,25 +0,0 @@
From dc07fb7df8d4f997877d8f98ea9ef8292f738ed3 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
--
2.50.1
@@ -1,81 +0,0 @@
From 496067ded4a3698468412e240b899755d92b314c 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 f56b47c268e..c5f757a6284 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}
--
2.50.1
@@ -1,26 +0,0 @@
From 3d0f96f3f53a7ff81532f077e9db69d7318db796 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 64a4a20e64f..9a8eb8dd8d1 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)
--
2.50.1
@@ -1,78 +0,0 @@
From b1ab523d6fa44aae8f3ec5f787a8f86f8686bf64 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 | 8 --------
gcc/config/riscv/t-linux | 7 +++++--
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 282c77b6a7b..07adae3d59c 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
%{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
-
-#define STARTFILE_PREFIX_SPEC \
- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
- "/lib/ " \
- "/usr/lib/ "
-
-#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
index a6f64f88d25..f88776ec520 100644
--- a/gcc/config/riscv/t-linux
+++ b/gcc/config/riscv/t-linux
@@ -1,5 +1,8 @@
-# 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
MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
--
2.50.1
@@ -1,51 +0,0 @@
From ee64e5ead8938d5be6cedd674158a25d93711fe3 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 0719fd0615d..80bb8f1622f 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -971,8 +971,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)
@@ -1177,10 +1178,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))))
@@ -1197,6 +1194,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; \
--
2.50.1
@@ -1,59 +0,0 @@
From 5adfe740c027fb8dc9931053f55f7eae222e6bb4 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:09:02 -0700
Subject: [PATCH] ada: libgnarl: remove use of glibc-specific
pthread_rwlockattr_setkind_np
musl's thread library does not implement it
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/libgnarl/s-osinte__linux.ads | 10 ----------
gcc/ada/libgnarl/s-taprop__linux.adb | 7 -------
2 files changed, 17 deletions(-)
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
index 7aeb15da523..5551b701e5a 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -402,16 +402,6 @@ package System.OS_Interface is
(attr : access pthread_rwlockattr_t) return int;
pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
- PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
- 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;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index 8f4c835baa7..6df36c7d8f4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is
Result : C.int;
begin
- -- Set the rwlock to prefer writer to avoid writers starvation
-
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);
--
2.50.1
@@ -1,50 +0,0 @@
From c8edb618208a854d121ff73c0d82d7cc467a3611 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:13:19 -0700
Subject: [PATCH] ada: libgnarl: use posix_openpt instead of glibc-specific
getpt to open a pty
musl only implements posix_openpt(3), not the older glibc-specific getpt()
and glibc implements both for ages.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/terminals.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 89f887556c0..93557fe2631 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1134,7 +1134,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
@@ -1148,7 +1148,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)
@@ -1197,8 +1197,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)
--
2.50.1
@@ -1,54 +0,0 @@
From d3c515c40b9ec0133787388ae7df037e88a95f73 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:18:49 -0700
Subject: [PATCH] ada: libgnarl: adaint: fix sched.h inclusion for musl
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/adaint.c | 6 +++++-
gcc/ada/adaint.h | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 1fcfae165a7..67318e647ed 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -95,6 +95,11 @@
#include <sys/pstat.h>
#endif
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
#endif
@@ -3476,7 +3481,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
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 3df12b5f956..26a489f2b78 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -40,6 +40,11 @@ extern "C" {
#include "mingw32.h"
#endif
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
#include <dirent.h>
/* Constants used for the form parameter encoding values */
--
2.50.1
@@ -1,256 +0,0 @@
From 3d13edda0134af3fbb802cdec6406c91003bbc33 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Wed, 9 Dec 2020 07:42:06 +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 | 31 ++++++++++++++++++++++++++++++-
gcc/configure.ac | 21 +++++++++++++++++++++
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(+), 5 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 1e039c20550..20f535a306a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -238,6 +238,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 8a531ed591c..40045ff35a5 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -131,6 +131,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 3c17ac6eade..0426efdb8c3 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 343563c8948..54300a2a867 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1003,6 +1003,7 @@ with_changes_root_url
enable_languages
with_multilib_list
with_multilib_generator
+enable_autolink_libatomic
with_zstd
with_zstd_include
with_zstd_lib
@@ -1742,6 +1743,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
@@ -8400,7 +8404,6 @@ else
fi
-
# Check whether --with-multilib-generator was given.
if test "${with_multilib_generator+set}" = set; then :
withval=$with_multilib_generator; :
@@ -8408,6 +8411,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
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b3948469d17..81c070830e2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1227,6 +1227,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
# -------------------------
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3e9e09b4ae3..6e7b756be61 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2617,6 +2617,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 a96700c0d38..16deedca64d 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -390,7 +390,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 eccc4d88493..4ca4c610571 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -390,7 +390,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 607c8ca1d42..e9f78f0f4c1 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1000,13 +1000,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
--
2.50.1
@@ -1,57 +0,0 @@
From ddc31942d7363acc938007d70f29e3e324064f76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 29 Aug 2021 12:23:34 +0200
Subject: [PATCH] configure: fix detection of atomic builtins in libatomic
configure script
Alpine's --enable-autolink-libatomic (which is enabled for riscv64 by
default) causes the libatomic configure script to incorrectly detect
which builtins are available on riscv64. This then causes incorrect code
generation for libatomic since it assumes compiler builtins to be
available which are not actually available on riscv64.
This commit fixes this issue by disabling linking of libatomic configure
test code entirely, thereby preventing linking against libatomic.
See:
* https://gitlab.alpinelinux.org/alpine/aports/-/issues/12948
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c6
---
libatomic/configure.tgt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 6db039d6e8b..2751b5c1387 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -30,6 +30,26 @@
# on ${target_cpu}. For example to allow proper use of multilibs.
configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
+# The libatomic configure script performs several checks to determine
+# whether builtins for atomic operations are available. When compiling
+# with --enable-autolink-libatomic the test code compiled by the
+# configure script is also linked against libatomic. This causes it
+# to think that builtins are available, even if there are not, since
+# the tested symbols are provided by libatomic.
+#
+# This is a hack to ensure that we don't link against libatomic by not
+# linking any configure test code at all when --enable-autolink-libatomic
+# is given.
+#
+# See:
+#
+# * https://gitlab.alpinelinux.org/alpine/aports/-/issues/12817
+# * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c4
+#
+if test x$enable_autolink_libatomic = xyes; then
+ gcc_no_link=yes
+fi
+
case "${target_cpu}" in
alpha*)
# fenv.c needs this option to generate inexact exceptions.
--
2.50.1
@@ -1,27 +0,0 @@
From e9f4662af949bc56eef27d531605dd90181bc300 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 30 Jun 2022 16:44:51 +0000
Subject: [PATCH] libstdc++: do not throw exceptions for non-C locales on musl
targets
---
libstdc++-v3/config/locale/generic/c_locale.cc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
index bfd02b5c2c6..16f9e84d66f 100644
--- a/libstdc++-v3/config/locale/generic/c_locale.cc
+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
@@ -242,9 +242,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Currently, the generic model only supports the "C" locale.
// See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
__cloc = 0;
- if (strcmp(__s, "C"))
- __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
- "name not valid"));
}
void
--
2.50.1
@@ -1,26 +0,0 @@
From b4c412a5d538f7478596880e89d0e6d5046ef16b Mon Sep 17 00:00:00 2001
From: Mathias LANG <pro.mathias.lang@gmail.com>
Date: Mon, 17 Jan 2022 03:49:21 +0000
Subject: [PATCH] gdc: unconditionally link libgphobos against libucontext
ref: alpine/aports#13422
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 20f535a306a..c087bfe7cd4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -54382,7 +54382,7 @@ configure-target-libphobos:
esac; \
module_srcdir=libphobos; \
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} \
--
2.50.1
@@ -1,54 +0,0 @@
From 0c10e5ee09685a5ecc39650e8ec8a1b4f5e096e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 16 Jul 2022 09:21:11 +0200
Subject: [PATCH] druntime: link against libucontext on all platforms
On musl-based Linux distributions, swapcontext etc. are not provided by
musl but instead by libucontext. Hence, we _always_ need to link against
an external library for these functions.
---
libphobos/configure | 8 --------
libphobos/m4/druntime/libraries.m4 | 8 --------
2 files changed, 16 deletions(-)
diff --git a/libphobos/configure b/libphobos/configure
index 4f5be7d4ff4..0a48032edb4 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -15420,14 +15420,6 @@ fi
# Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
# "yes" for targets that have 'version = AsmExternal'.
druntime_fiber_asm_external=no
- case "$target_cpu" in
- aarch64* | \
- arm* | \
- i[34567]86|x86_64 | \
- powerpc)
- druntime_fiber_asm_external=yes
- ;;
- esac
if test "$druntime_fiber_asm_external" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
$as_echo_n "checking for library containing swapcontext... " >&6; }
diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4
index 8dd9c7da107..b61bf528a14 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -220,14 +220,6 @@ AC_DEFUN([DRUNTIME_LIBRARIES_UCONTEXT],
# Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
# "yes" for targets that have 'version = AsmExternal'.
druntime_fiber_asm_external=no
- case "$target_cpu" in
- aarch64* | \
- arm* | \
- i[[34567]]86|x86_64 | \
- powerpc)
- druntime_fiber_asm_external=yes
- ;;
- esac
if test "$druntime_fiber_asm_external" = no; then
AC_SEARCH_LIBS([swapcontext], [c ucontext], [],
AC_MSG_ERROR([swapcontext required but not found]))
--
2.50.1
Loaded 100 of 4645 files, more files were not shown because too many files have changed in this diff. Show more