Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 46f32bb

Browse files
Jb Aviatignisf
authored andcommitted
Do not embed debug symbols in macOS libraries
This dramatically lowers the produced binary size.
1 parent 2b0c8e6 commit 46f32bb

5 files changed

Lines changed: 49 additions & 22 deletions

patches/0001-Build-a-standalone-static-library.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From 8e34b0f097ea5ea5bbde4ee8b7fd6521d40dd5e3 Mon Sep 17 00:00:00 2001
1+
From 8c1707d7eeb86824f03c0f02e724d27663cb768f Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <bordjukov@gmail.com>
33
Date: Mon, 25 Jul 2016 00:00:19 +0300
4-
Subject: [PATCH 1/4] Build a standalone static library
4+
Subject: [PATCH 1/5] Build a standalone static library
55

66
---
77
gypfiles/standalone.gypi | 3 +++
88
1 file changed, 3 insertions(+)
99

1010
diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
11-
index c6c26fb..a59e12b 100644
11+
index c6c26fbbb5..a59e12bbfc 100644
1212
--- a/gypfiles/standalone.gypi
1313
+++ b/gypfiles/standalone.gypi
1414
@@ -505,6 +505,9 @@
@@ -22,5 +22,5 @@ index c6c26fb..a59e12b 100644
2222
'defines!': [
2323
'DEBUG',
2424
--
25-
2.9.3
25+
2.11.1
2626

patches/0002-Don-t-compile-unnecessary-stuff.patch

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
From 48d4b7ae6cbb8a2109555f57845fa5f6aa4fa30a Mon Sep 17 00:00:00 2001
1+
From 968b21f2063fa03267ebe52548d4bf94a1838983 Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <bordjukov@gmail.com>
3-
Date: Mon, 25 Jul 2016 00:04:07 +0300
4-
Subject: [PATCH 2/4] Don't compile unnecessary stuff
3+
Date: Sat, 15 Oct 2016 15:05:01 +0300
4+
Subject: [PATCH 2/5] Don't compile unnecessary stuff
55

66
---
77
Makefile | 7 +------
8-
gypfiles/all.gyp | 32 --------------------------------
9-
2 files changed, 1 insertion(+), 38 deletions(-)
8+
gypfiles/all.gyp | 34 +---------------------------------
9+
2 files changed, 2 insertions(+), 39 deletions(-)
1010

1111
diff --git a/Makefile b/Makefile
12-
index ffb5192..8e60aab 100644
12+
index ffb5192bfa..8e60aabc02 100644
1313
--- a/Makefile
1414
+++ b/Makefile
1515
@@ -265,12 +265,7 @@ GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
@@ -27,13 +27,14 @@ index ffb5192..8e60aab 100644
2727
# If vtunejit=on, the v8vtune.gyp will be appended.
2828
ifeq ($(vtunejit), on)
2929
diff --git a/gypfiles/all.gyp b/gypfiles/all.gyp
30-
index ff1bea4..96820a0 100644
30+
index ff1bea4b61..9b02b4d305 100644
3131
--- a/gypfiles/all.gyp
3232
+++ b/gypfiles/all.gyp
33-
@@ -16,38 +16,6 @@
33+
@@ -15,39 +15,7 @@
34+
'dependencies': [
3435
'../tools/parser-shell.gyp:parser-shell',
3536
],
36-
}],
37+
- }],
3738
- # These items don't compile for Android on Mac.
3839
- ['host_os!="mac" or OS!="android"', {
3940
- 'dependencies': [
@@ -66,9 +67,10 @@ index ff1bea4..96820a0 100644
6667
- '../tools/run-valgrind.gyp:*',
6768
- ],
6869
- }],
70+
+ }]
6971
]
7072
}
7173
]
7274
--
73-
2.9.3
75+
2.11.1
7476

patches/0003-Use-the-fPIC-flag-for-the-static-library.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From 44da612b4aa078bc2090cad3bd42506f444dd900 Mon Sep 17 00:00:00 2001
1+
From b0f5f916c4b6b908c0ece2805ecad22cff644c0f Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <bordjukov@gmail.com>
33
Date: Mon, 25 Jul 2016 00:05:47 +0300
4-
Subject: [PATCH 3/4] Use the -fPIC flag for the static library
4+
Subject: [PATCH 3/5] Use the -fPIC flag for the static library
55

66
---
77
gypfiles/standalone.gypi | 2 +-
88
1 file changed, 1 insertion(+), 1 deletion(-)
99

1010
diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
11-
index a59e12b..4e64f2e 100644
11+
index a59e12bbfc..4e64f2ed94 100644
1212
--- a/gypfiles/standalone.gypi
1313
+++ b/gypfiles/standalone.gypi
1414
@@ -772,7 +772,7 @@
@@ -21,5 +21,5 @@ index a59e12b..4e64f2e 100644
2121
}],
2222
[ 'clang==0 and coverage==1', {
2323
--
24-
2.9.3
24+
2.11.1
2525

patches/0004-Reinterpret-thread-hash-for-FreeBSD-too.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From cf7ec827796ccaef75e77bd83771e7f31b645d2f Mon Sep 17 00:00:00 2001
1+
From c04e8c3d31921526dfcb726a79b92c55d22713bf Mon Sep 17 00:00:00 2001
22
From: Petko Bordjukov <bordjukov@gmail.com>
33
Date: Wed, 27 Jul 2016 06:20:13 +0300
4-
Subject: [PATCH 4/4] Reinterpret thread hash for FreeBSD, too
4+
Subject: [PATCH 4/5] Reinterpret thread hash for FreeBSD, too
55

66
---
77
src/libsampler/v8-sampler.cc | 2 +-
88
1 file changed, 1 insertion(+), 1 deletion(-)
99

1010
diff --git a/src/libsampler/v8-sampler.cc b/src/libsampler/v8-sampler.cc
11-
index edf6df1..9b2a718 100644
11+
index edf6df130e..9b2a71893b 100644
1212
--- a/src/libsampler/v8-sampler.cc
1313
+++ b/src/libsampler/v8-sampler.cc
1414
@@ -194,7 +194,7 @@ void* ThreadKey(pthread_t thread_id) {
@@ -21,5 +21,5 @@ index edf6df1..9b2a718 100644
2121
#else
2222
return static_cast<uint32_t>(thread_id);
2323
--
24-
2.9.3
24+
2.11.1
2525

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 61cf732ad34ca121b6c57556596504ea631798b4 Mon Sep 17 00:00:00 2001
2+
From: Jb Aviat <jb@sqreen.io>
3+
Date: Mon, 27 Feb 2017 11:14:42 +0200
4+
Subject: [PATCH 5/5] Do not embed debug symbols in macOS libraries
5+
6+
This lowers dramatically the produced binary size
7+
---
8+
gypfiles/standalone.gypi | 1 +
9+
1 file changed, 1 insertion(+)
10+
11+
diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
12+
index 4e64f2ed94..dcf2bfa266 100644
13+
--- a/gypfiles/standalone.gypi
14+
+++ b/gypfiles/standalone.gypi
15+
@@ -1031,6 +1031,7 @@
16+
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
17+
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
18+
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
19+
+ 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO', # No -gdwarf-2
20+
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
21+
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
22+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
23+
--
24+
2.11.1
25+

0 commit comments

Comments
 (0)