From be565320c082c00069614c850d29b42831b3dea6 Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@cloudius-systems.com>
Date: Thu, 21 Nov 2013 18:47:44 +0200
Subject: [PATCH] build: bring back libgcc_s.so

Commit c9e61d4a45d88d ("build: link libstdc++, libgcc_s only once") threw
away libgcc_s.so since we already link with libgcc.a and libgcc_eh.a, which
provide the same symbols, and since having the same symbols in multiple
objects violates certain C++ rules.

However, libgcc_eh.a provides certain symbols only as local symbols, which
means they aren't available to the payload.  This manifests itself in errors
such as failing to find _Unwind_Resume if an exception is thrown.

(This is likely due to the requirement that mulitple objects linked with
libgcc_eh.a work together, which also brings some confidence that the ODR
violations of having two versions of the library won't bite us).

Fix the problem by adding libgcc_s.so to the filesystem and allowing
the payload to link to it.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
---
 core/elf.cc       | 1 -
 usr.manifest.skel | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/elf.cc b/core/elf.cc
index 5ccc86fe1..ea2637dcf 100644
--- a/core/elf.cc
+++ b/core/elf.cc
@@ -747,7 +747,6 @@ program::program(::filesystem& fs, void* addr)
     set_object("libdl.so.2", _core);
     set_object("librt.so.1", _core);
     set_object("libstdc++.so.6", _core);
-    set_object("libgcc_s.so.1", _core);
     set_object("libboost_system-mt.so.1.53.0", _core);
     set_object("libboost_program_options-mt.so.1.53.0", _core);
 }
diff --git a/usr.manifest.skel b/usr.manifest.skel
index 32215221f..bf3566ed3 100644
--- a/usr.manifest.skel
+++ b/usr.manifest.skel
@@ -1,4 +1,5 @@
 [manifest]
+/usr/lib/libgcc_s.so.1: %(gccbase)s/lib64/libgcc_s.so.1
 /usr/lib/jvm/&/jre/lib/amd64/server/libjvm.so: %(jdkbase)s/&
 /usr/lib/jvm/&/jre/lib/amd64/libverify.so: %(jdkbase)s/&
 /usr/lib/jvm/&/jre/lib/amd64/libjava.so: %(jdkbase)s/&
-- 
GitLab