Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Add gcc patch for libbacktrace #148

Merged
merged 7 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export PKGEXT='.pkg.tar.xz'

for package in "${packages[@]}"; do
execute 'Building binary' makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --syncdeps --rmdeps --cleanbuild
MINGW_ARCH=mingw64 execute 'Building source' makepkg-mingw --noconfirm --noprogressbar --allsource
MINGW_ARCH=mingw64 execute 'Building source' makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --allsource
execute 'List output contents' ls -ltr
execute 'Installing' yes:pacman --noprogressbar --upgrade *.pkg.tar.xz
execute 'Checking Binaries' find ./pkg -regex ".*\.\(exe\|dll\|a\|pc\)"
Expand Down
23 changes: 23 additions & 0 deletions mingw-w64-gcc/0150-libbacktrace-seh.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
libgcc/Changelog:
* unwind-seh.c (_Unwind_Backtrace): Set the ra and cfa pointers
before calling the callback.
---
libgcc/unwind-seh.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/libgcc/unwind-seh.c b/libgcc/unwind-seh.c
index 1a70180cfaa..275d782903a 100644
--- a/libgcc/unwind-seh.c
+++ b/libgcc/unwind-seh.c
@@ -466,6 +466,11 @@ _Unwind_Backtrace(_Unwind_Trace_Fn trace,
&gcc_context.disp->HandlerData,
&gcc_context.disp->EstablisherFrame, NULL);

+ /* Set values that the callback can inspect via _Unwind_GetIP
+ * and _Unwind_GetCFA. */
+ gcc_context.ra = ms_context.Rip;
+ gcc_context.cfa = ms_context.Rsp;
+
/* Call trace function. */
if (trace (&gcc_context, trace_argument) != _URC_NO_REASON)
return _URC_FATAL_PHASE1_ERROR;
14 changes: 11 additions & 3 deletions mingw-w64-gcc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Contributor: Alexey Borzenkov <[email protected]>
# Contributor: Ray Donnelly <[email protected]>
# Contributor: Renato Silva <[email protected]>
# Contributor: Kirill Müller <[email protected]>
# Rtools: Jeroen Ooms <[email protected]>

_realname=gcc
Expand All @@ -11,7 +12,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=8.3.0
_srcver=8.3.0
#_srcver=8.3.0-RC-20190215
pkgrel=9501
pkgrel=9502
pkgdesc="GCC for the MinGW-w64"
arch=('any')
url="https://gcc.gnu.org"
Expand Down Expand Up @@ -49,7 +50,8 @@ source=("https://ftp.gnu.org/gnu/gcc/${_realname}-${pkgver}/${_realname}-${pkgve
0019-gcc-8-branch-Backport-patches-for-std-filesystem-from-master.patch
0130-libstdc++-in-out.patch
0140-gcc-8.2.0-diagnostic-color.patch
pr88568.patch)
pr88568.patch
0150-libbacktrace-seh.patch)
sha256sums=('ea71adc1c3d86330874b8df19611424b143308f0d6612d542472600532c96d2d'
'SKIP'
'dea2bbad4967280910559c6a11b865aeec19cab34647fb5894cb498b24b14462'
Expand All @@ -67,7 +69,8 @@ sha256sums=('ea71adc1c3d86330874b8df19611424b143308f0d6612d542472600532c96d2d'
'bf83cbc79de4c86f02664c8a624e26b12f570e3c31116fc7c46ecf655696f9a6'
'ba2f77db605577d08e4079f08a7a9556c975b5416be8610c5be31e915637feb7'
'e467f0ac68b349de826c79b00a45c5ad9e7c5a55d06b9b9fa7afd94c597f6376'
'4bbcb71f7e9e25af641e7abcb12ea4cd7a5ade3a82739414c65259afcbf21256')
'4bbcb71f7e9e25af641e7abcb12ea4cd7a5ade3a82739414c65259afcbf21256'
'88c1d65e763e631ad49f9a077ed631f4acac9ef4732e2818ccddaefc883b1811')

_threads="posix"

Expand Down Expand Up @@ -125,6 +128,11 @@ prepare() {
apply_patch_with_msg \
pr88568.patch

# ensure libbacktrace works with SEH
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96948
apply_patch_with_msg \
0150-libbacktrace-seh.patch

# do not expect ${prefix}/mingw symlink - this should be superceded by
# 0005-Windows-Don-t-ignore-native-system-header-dir.patch .. but isn't!
sed -i 's/${prefix}\/mingw\//${prefix}\//g' configure
Expand Down