dev-lang/fbc: Add patch for proper symbol stripping behavior

Package-Manager: Portage-2.3.65, Repoman-2.3.12
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
This commit is contained in:
William Breathitt Gray 2019-05-06 20:52:22 +09:00
parent 1ec25978a0
commit d3c50b4522
No known key found for this signature in database
GPG Key ID: 86FA4835D9BB5492
3 changed files with 174 additions and 11 deletions

View File

@ -1,4 +1,4 @@
DIST FreeBASIC-1.06.0-source-bootstrap.tar.xz 7742292 BLAKE2B fd32c6e5edf6e8c27538465141c6b870d6c893f8e05fc8d91b273f9268a68065709cba95e8c5cd8b86786522b2ac1eaf1a6a547227432bbc9998eb1288b29515 SHA512 42878091994cae7e0a2f4ba1d2d83a80d32d62ad06790ac06643a266200b53b7ce2480a651b1622910a2733756b7ca032a5be1bb73ee3f796146394eebb9f43c
DIST fbc-1.06.0-bootstrap-dist-linux-x86.patch 125456 BLAKE2B 14bf25ed51d04773a8c98408f76ce79fcc165500e3ef67fc9407971f92fdb359dfc9abe8feb989ad6fd0b710b26d99ac478561d561a0687c213d048d41610ca9 SHA512 39622d88ef1b83bbe309df937139e73e6bdae87c4e0461a170aa4b792a74a295060f2b770fa81e74a0a973a9ae816fadf18d75a1075d9112dd68c83ca3e0cbb6
DIST fbc-1.06.0-bootstrap-dist-linux-x86_64.patch 58219 BLAKE2B f28a4b74b8648a3128d2e8f273af55e5f1880fe35c5acef31ceed7b33386c5fb6b83ed4657138515abb95891ce8bc157aea339f8ba947dece4df1f2876e926b7 SHA512 e62b6969a93f214a6c1d246c734ab2b9045ee7ad9558d0871589945613d11ae0815945b3270213bc959c792903e86cf38555b6fd68b0d0c9ec68f8ef61ea9a0e
DIST fbc-1.06.0-bootstrap-dist-linux-x86.patch 147301 BLAKE2B 8320f988bc84f5df1b732719a11d1a8edbfceff04ad51b1fbd883eb21d20f1c2f16b8c6ae41b5b0472e4faf1058345969b85ed0c93c071de3c9ed703e298106a SHA512 b2ee285504ce0f8a6a01ee5da7661e40c4a6bb0075f26751fbc79a328cac66f7809ad4c2489eaab01a6e6432ca6d76e19835c86bddf9df5af3b89c547fd8ffb3
DIST fbc-1.06.0-bootstrap-dist-linux-x86_64.patch 198197 BLAKE2B 72083bef84aed5ec2d95badb70a42db2e5d89084454f79aef41808a018ab238b1d230cb7282f4adf1be9d003c3865cb914fbf057fbd84c069dfecc4abd3da80b SHA512 771077a2526164223c3ae157558355538701224863b2a5923881ac2d2568f4cd1f5489df73aa8d55b1efccc82fe9e251e893a2b361363c1862d4c1e7bc3fb4ba
DIST fbc-1.06.0.tar.gz 8847831 BLAKE2B 9245137995f9f3e2ff5adaf9b273593434ac9ec96919b2c970ec26183fe6fb7afee35753f2dd92f4b34d1aade92871e5a6722571a5ba04dde323fd7fb06c55c5 SHA512 687dcf665bb10e6a771cc01d02c21da77d89e052308600038dce526ba1ccfc6554d409dab184f3495557c9e4fdf744fd7a9088b4b137b782a9ab8633622c5484

View File

@ -7,8 +7,8 @@ DESCRIPTION="FreeBASIC - A free/open source, multi-platform BASIC compiler."
HOMEPAGE="https://www.freebasic.net"
SRC_URI="https://github.com/freebasic/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
https://github.com/freebasic/${PN}/releases/download/${PV}/FreeBASIC-${PV}-source-bootstrap.tar.xz
https://gist.github.com/vilhelmgray/08cebe0f22e303f7d5e6e5bc71e3d1f2/raw/710ba9ded1c7772f23fd68c08e02402f167d2c56/fbc-1.06.0-bootstrap-dist-linux-x86.patch
https://gist.github.com/vilhelmgray/08cebe0f22e303f7d5e6e5bc71e3d1f2/raw/710ba9ded1c7772f23fd68c08e02402f167d2c56/fbc-1.06.0-bootstrap-dist-linux-x86_64.patch"
https://gist.github.com/vilhelmgray/08cebe0f22e303f7d5e6e5bc71e3d1f2/raw/70c1f43eec81c35bdc780ace7fdf6a3c8b548c85/fbc-1.06.0-bootstrap-dist-linux-x86.patch
https://gist.github.com/vilhelmgray/08cebe0f22e303f7d5e6e5bc71e3d1f2/raw/70c1f43eec81c35bdc780ace7fdf6a3c8b548c85/fbc-1.06.0-bootstrap-dist-linux-x86_64.patch"
LICENSE="FDL-1.2 GPL-2+ LGPL-2.1+"
SLOT="0"
@ -80,14 +80,8 @@ src_compile() {
$(usex X "" " -DDISABLE_X11")
)
# fbc automatically strips the executables it compiles; in order to avoid
# creating striped executables, we override the fbc hardcoded linker "-s"
# flag with our own; "--strip-debug" was chosen arbitrarily (without the
# "-g" flag the executable should not have debug_info symbols anyway, so the
# "--strip-debug" flag should be a safe option)
local fblflags="-Wl --strip-debug "
# fbc requires a space after the -Wl option
fblflags+=${LDFLAGS//-Wl,/-Wl }
local fblflags=${LDFLAGS//-Wl,/-Wl }
# Build fbc
emake CFLAGS="${CFLAGS} ${xcflags[*]}" FBC="${fbc}" FBCFLAGS="${fbcflags}" FBLFLAGS="${fblflags}"

View File

@ -0,0 +1,169 @@
From b8bfa87f56a86c3c81976b1a8c0411ac4240ae9e Mon Sep 17 00:00:00 2001
From: William Breathitt Gray <vilhelm.gray@gmail.com>
Date: Wed, 24 Apr 2019 16:59:08 +0900
Subject: [PATCH] Implement the '-strip'/'-nostrip' compiler options
This change allows users to choose whether or not to strip symbol
information from the output file. The fbc '-strip' option is analogous
to the ld '--strip-all' option. The ENABLE_STRIPALL compiler build
option is introduced to configure whether fbc defaults to stripping
symbols.
This fixes issue #140.
---
makefile | 8 ++++++++
src/compiler/fbc.bas | 21 ++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/makefile b/makefile
index 245e95669..519fe7e7b 100644
--- a/makefile
+++ b/makefile
@@ -81,6 +81,7 @@
# ENABLE_SUFFIX=-0.24 append a string like "-0.24" to fbc/FB dir names,
# and use "-d ENABLE_SUFFIX=$(ENABLE_SUFFIX)" (non-standalone only)
# ENABLE_LIB64=1 use prefix/lib64/ instead of prefix/lib/ for 64bit libs (non-standalone only)
+# ENABLE_STRIPALL=1 use "-d ENABLE_STRIPALL" with select targets
# FBPACKAGE bindist: The package/archive file name without path or extension
# FBPACKSUFFIX bindist: Allows adding a custom suffix to the normal package name (and the toplevel dir in the archive)
# FBMANIFEST bindist: The manifest file name without path or extension
@@ -92,6 +93,7 @@
# -d ENABLE_SUFFIX=-0.24 assume FB's lib dir uses the given suffix (non-standalone only)
# -d ENABLE_PREFIX=/some/path hard-code specific $(prefix) into fbc
# -d ENABLE_LIB64 use prefix/lib64/ instead of prefix/lib/ for 64bit libs (non-standalone only)
+# -d ENABLE_STRIPALL configure fbc to pass down '--strip-all' to linker by default
#
# rtlib/gfxlib2 source code configuration (CFLAGS):
# -DDISABLE_X11 build without X11 headers (disables X11 gfx driver)
@@ -429,6 +431,12 @@ endif
ifdef ENABLE_LIB64
ALLFBCFLAGS += -d ENABLE_LIB64
endif
+ifdef ENABLE_STRIPALL
+ ifneq ($(filter dos win32,$(TARGET_OS)),)
+ ALLFBCFLAGS += -d ENABLE_STRIPALL
+ endif
+endif
+
ALLFBCFLAGS += $(FBCFLAGS) $(FBFLAGS)
ALLFBLFLAGS += $(FBLFLAGS) $(FBFLAGS)
diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas
index f6fa3d9db..f9b665bbc 100644
--- a/src/compiler/fbc.bas
+++ b/src/compiler/fbc.bas
@@ -100,6 +100,7 @@ type FBCCTX
xbe_title as zstring * FB_MAXNAMELEN+1 '' For the '-title <title>' xbox option
nodeflibs as integer
staticlink as integer
+ stripsymbols as integer
'' Compiler paths
prefix as zstring * FB_MAXPATHLEN+1 '' Path from -prefix or empty
@@ -163,6 +164,10 @@ private sub fbcInit( )
fbGlobalInit()
+#ifdef ENABLE_STRIPALL
+ fbc.stripsymbols = TRUE
+#endif
+
fbc.objinf.lang = fbGetOption( FB_COMPOPT_LANG )
fbc.print = -1
@@ -762,7 +767,7 @@ private function hLinkFiles( ) as integer
if( fbGetOption( FB_COMPOPT_DEBUGINFO ) = FALSE ) then
if( fbGetOption( FB_COMPOPT_PROFILE ) = FALSE ) then
- if( fbGetOption( FB_COMPOPT_TARGET ) <> FB_COMPTARGET_DARWIN ) then
+ if( fbc.stripsymbols ) then
ldcline += " -s"
end if
end if
@@ -1417,6 +1422,7 @@ enum
OPT_NODEFLIBS
OPT_NOERRLINE
OPT_NOOBJINFO
+ OPT_NOSTRIP
OPT_O
OPT_OPTIMIZE
OPT_P
@@ -1432,6 +1438,7 @@ enum
OPT_S
OPT_SHOWINCLUDES
OPT_STATIC
+ OPT_STRIP
OPT_T
OPT_TARGET
OPT_TITLE
@@ -1480,6 +1487,7 @@ dim shared as integer option_takes_argument(0 to (OPT__COUNT - 1)) = _
FALSE, _ '' OPT_NODEFLIBS
FALSE, _ '' OPT_NOERRLINE
FALSE, _ '' OPT_NOOBJINFO
+ FALSE, _ '' OPT_NOSTRIP
TRUE , _ '' OPT_O
TRUE , _ '' OPT_OPTIMIZE
TRUE , _ '' OPT_P
@@ -1495,6 +1503,7 @@ dim shared as integer option_takes_argument(0 to (OPT__COUNT - 1)) = _
TRUE , _ '' OPT_S
FALSE, _ '' OPT_SHOWINCLUDES
FALSE, _ '' OPT_STATIC
+ FALSE, _ '' OPT_STRIP
TRUE , _ '' OPT_T
TRUE , _ '' OPT_TARGET
TRUE , _ '' OPT_TITLE
@@ -1676,6 +1685,9 @@ private sub handleOpt(byval optid as integer, byref arg as string)
case OPT_NOOBJINFO
fbSetOption( FB_COMPOPT_OBJINFO, FALSE )
+ case OPT_NOSTRIP
+ fbc.stripsymbols = FALSE
+
case OPT_O
'' Error if there already is an -o waiting to be assigned
hCheckWaitingObjfile( )
@@ -1765,6 +1777,9 @@ private sub handleOpt(byval optid as integer, byref arg as string)
case OPT_STATIC
fbc.staticlink = TRUE
+ case OPT_STRIP
+ fbc.stripsymbols = TRUE
+
case OPT_T
fbSetOption( FB_COMPOPT_STACKSIZE, clng( arg ) * 1024 )
@@ -1963,6 +1978,7 @@ private function parseOption(byval opt as zstring ptr) as integer
CHECK("noerrline", OPT_NOERRLINE)
CHECK("nodeflibs", OPT_NODEFLIBS)
CHECK("noobjinfo", OPT_NOOBJINFO)
+ CHECK("nostrip", OPT_NOSTRIP)
case asc("o")
ONECHAR(OPT_O)
@@ -1990,6 +2006,7 @@ private function parseOption(byval opt as zstring ptr) as integer
ONECHAR(OPT_S)
CHECK("showincludes", OPT_SHOWINCLUDES)
CHECK("static", OPT_STATIC)
+ CHECK("strip", OPT_STRIP)
case asc("t")
ONECHAR(OPT_T)
@@ -3384,6 +3401,7 @@ private sub hPrintOptions( )
print " -nodeflibs Do not include the default libraries"
print " -noerrline Do not show source context in error messages"
print " -noobjinfo Do not read/write compile-time info from/to .o and .a files"
+ print " -nostrip Do not strip symbol information from the output file"
print " -o <file> Set .o (or -pp .bas) file name for prev/next input file"
print " -O <value> Optimization level (default: 0)"
print " -p <path> Add a library search path"
@@ -3401,6 +3419,7 @@ private sub hPrintOptions( )
print " -s console|gui Select win32 subsystem"
print " -showincludes Display a tree of file names of #included files"
print " -static Prefer static libraries over dynamic ones when linking"
+ print " -strip Omit all symbol information from the output file"
print " -t <value> Set .exe stack size in kbytes, default: 1024 (win32/dos)"
print " -target <name> Set cross-compilation target"
print " -title <name> Set XBE display title (xbox)"
--
2.21.0