Skip to content
Closed
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
67 changes: 67 additions & 0 deletions base/comps/gcc/overlays/0002-libbacktrace-static.overlay.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Azure Linux exposes GCC's internal libbacktrace as a standalone

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question(blocking):

Did we evaluate the trade-off of building the library from https://github.com/ianlancetaylor/libbacktrace instead?

openSUSE and Debian appear to get it directly from there. (IF you notice the gcc internal copy of the library lists the same author in its copyright notice.)

(openSUSE also has a .spec for this location.)

# `libbacktrace-static` subpackage. There is no upstream package to
# import. Downstream consumers need the static library + header
# at build time, so we install them here.

[metadata]
category = "azl-platform-adaptation"
upstream-status = "inapplicable"

# Bump the manual gcc release so the new subpackage and its dependents rebuild.
[[overlays]]
description = "Bump gcc release for the added libbacktrace-static subpackage"
type = "spec-search-replace"
regex = '^%global gcc_release 7$'
replacement = "%global gcc_release 8"

# Declare the new subpackage right after the C++ package/description block.
[[overlays]]
description = "Declare the libbacktrace-static subpackage"
type = "spec-append-lines"
section = "%description"
package = "c++"
lines = [
"%package -n libbacktrace-static",
"Summary: Static library for GCC's libbacktrace",
"",
"%description -n libbacktrace-static",
"This package contains GCC's static libbacktrace library and its header.",
"",
]

# Install the internal libbacktrace static archive and its header.
[[overlays]]
description = "Install libbacktrace static library and header into the buildroot"
type = "spec-append-lines"
section = "%install"
lines = [
"# Azure Linux: expose GCC's internal libbacktrace as a static library + header.",
"_azl_bt=%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/libbacktrace/.libs/libbacktrace.a",
"install -m 0644 -D \"$_azl_bt\" %{buildroot}%{_libdir}/libbacktrace.a",
Comment thread
liunan-ms marked this conversation as resolved.
"install -m 0644 -D %{_builddir}/gcc-%{version}-%{DATE}/libbacktrace/backtrace.h %{buildroot}%{_includedir}/backtrace.h",
"",
]

# List the installed libbacktrace-static files.
[[overlays]]
description = "Package the libbacktrace-static files"
type = "spec-append-lines"
section = "%files"
package = "c++"
lines = [
"%files -n libbacktrace-static",
"%{_includedir}/backtrace.h",
"%{_libdir}/libbacktrace.a",
"",
]

[[overlays]]
description = "Add changelog entry for the libbacktrace-static subpackage"
type = "spec-prepend-lines"
section = "%changelog"
lines = [
"* Fri Aug 14 2026 Nan Liu <liunan@microsoft.com> - 15.2.1-8",
"- Add libbacktrace-static subpackage exposing GCC's internal libbacktrace",
" static library and header for downstream consumers.",
"",
]
2 changes: 1 addition & 1 deletion locks/gcc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
version = 1
import-commit = 'fef47e540ee170873511546e35fc912cceed23f1'
upstream-commit = 'fef47e540ee170873511546e35fc912cceed23f1'
input-fingerprint = 'sha256:9cba33f3d0d76e1ebc779c654cb919773192af830efc66a9bc45454c89b42071'
input-fingerprint = 'sha256:f7bfc24cb117570fda996fc1a6963305202fc45b15c114a7984cca4be7957394'
resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e'
21 changes: 20 additions & 1 deletion specs/g/gcc/gcc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%global gcc_major 15
# Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 7
%global gcc_release 8
%global nvptx_tools_gitrev a0c1fff6534a4df9fb17937c3c4a4b1071212029
%global newlib_cygwin_gitrev d35cc82b5ec15bb8a5fe0fe11e183d1887992e99
%global _unpackaged_files_terminate_build 0
Expand Down Expand Up @@ -402,6 +402,12 @@ This package adds C++ support to the GNU Compiler Collection.
It includes support for most of the current C++ specification,
including templates and exception handling.

%package -n libbacktrace-static
Summary: Static library for GCC's libbacktrace

%description -n libbacktrace-static
This package contains GCC's static libbacktrace library and its header.

%package -n libstdc++
Summary: GNU Standard C++ Library
Autoreq: true
Expand Down Expand Up @@ -2473,6 +2479,11 @@ ln -sf gcc-annobin.so.0.0.0 $FULLPATH/plugin/gcc-annobin.so.0
ln -sf gcc-annobin.so.0.0.0 $FULLPATH/plugin/gcc-annobin.so
%endif

# Azure Linux: expose GCC's internal libbacktrace as a static library + header.
_azl_bt=%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/libbacktrace/.libs/libbacktrace.a
install -m 0644 -D "$_azl_bt" %{buildroot}%{_libdir}/libbacktrace.a
install -m 0644 -D %{_builddir}/gcc-%{version}-%{DATE}/libbacktrace/backtrace.h %{buildroot}%{_includedir}/backtrace.h

%check
cd obj-%{gcc_target_platform}

Expand Down Expand Up @@ -3032,6 +3043,10 @@ end
%endif
%doc rpm.doc/changelogs/gcc/cp/ChangeLog*

%files -n libbacktrace-static
%{_includedir}/backtrace.h
%{_libdir}/libbacktrace.a

%files -n libstdc++
%{_prefix}/%{_lib}/libstdc++.so.6*
%dir %{_datadir}/gdb
Expand Down Expand Up @@ -3814,6 +3829,10 @@ end
%endif

%changelog
* Fri Aug 14 2026 Nan Liu <liunan@microsoft.com> - 15.2.1-8
- Add libbacktrace-static subpackage exposing GCC's internal libbacktrace
static library and header for downstream consumers.

* Fri Jan 23 2026 Jakub Jelinek <jakub@redhat.com> 15.2.1-7
- update from releases/gcc-15 branch
- PRs c++/122070, c++/122550, c++/123597, libstdc++/123147,
Expand Down
Loading