Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 812026 - dev-build/libtool filters -static-libasan
Summary: dev-build/libtool filters -static-libasan
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2021-09-07 16:29 UTC by Joakim Tjernlund
Modified: 2024-09-25 20:24 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0055-pass-flags-unchanged.patch (file_812026.txt,1.12 KB, patch)
2021-10-06 07:52 UTC, Joakim Tjernlund
Details | Diff
v2: adapt to Gentoo ebuild practise (file_812026.txt,2.09 KB, text/plain)
2021-10-06 11:48 UTC, Joakim Tjernlund
Details
static-asan for elt-patches (file_812026.txt,2.12 KB, patch)
2021-11-02 22:48 UTC, Joakim Tjernlund
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Tjernlund 2021-09-07 16:29:18 UTC
Which makes it impossible to build a static ASAN app.
This hack lets static-libasan through:

diff -u /usr/share/libtool/build-aux/ltmain.sh~ /usr/share/libtool/build-aux/ltmain.sh
--- /usr/share/libtool/build-aux/ltmain.sh~	2021-02-08 17:32:08.000000000 +0100
+++ /usr/share/libtool/build-aux/ltmain.sh	2021-09-07 17:58:08.414406931 +0200
@@ -7337,7 +7337,7 @@
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
       -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
-      -specs=*|-fsanitize=*|-fuse-ld=*)
+      -specs=*|-fsanitize=*|-fuse-ld=*|-static-libasan)
         func_quote_for_eval "$arg"
 	arg=$func_quote_for_eval_result
         func_append compile_command " $arg"
Comment 1 Joakim Tjernlund 2021-09-22 14:34:27 UTC
Debian seems to have this covered in 0055-pass-flags-unchanged.patch:

Description: Pass more flags to the linker unchanged. Closes: #751161.
Author: Vincent Lefevre <vincent@vinc17.net>
Last-Updated: 2019-05-03

--- libtool-2.4.6-a/build-aux/ltmain.in	2019-05-03 11:11:05.000000000 +0200
+++ libtool-2.4.6-b/build-aux/ltmain.in	2019-05-03 11:18:59.209409497 +0200
@@ -5383,10 +5383,12 @@
       # -stdlib=*            select c++ std lib with clang
       # -fsanitize=*         Clang/GCC memory and address sanitizer
       # -fuse-ld=*           Linker select flags for GCC
+      # -static-*            direct GCC to link specific libraries statically
+      # -fcilkplus           Cilk Plus language extension features for C/C++
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
       -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
-      -specs=*|-fsanitize=*|-fuse-ld=*)
+      -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
         func_quote_for_eval "$arg"
 	arg=$func_quote_for_eval_result
         func_append compile_command " $arg"
Comment 2 SpanKY gentoo-dev 2021-09-29 07:09:11 UTC
have you sent this upstream yet ?
Comment 3 Joakim Tjernlund 2021-09-29 07:25:16 UTC
(In reply to SpanKY from comment #2)
> have you sent this upstream yet ?

No I haven't. Don't know if Debian has.
Upstream appears dead though.
Comment 4 Joakim Tjernlund 2021-09-29 07:29:55 UTC
(In reply to Joakim Tjernlund from comment #3)
> (In reply to SpanKY from comment #2)
> > have you sent this upstream yet ?
> 
> No I haven't. Don't know if Debian has.
> Upstream appears dead though.

Looked in the libtool mail archive and found Debians patch here:
https://lists.gnu.org/archive/html/libtool-patches/2019-05/msg00000.html
Comment 5 SpanKY gentoo-dev 2021-10-06 07:39:54 UTC
(In reply to Joakim Tjernlund from comment #3)
> Upstream appears dead though.

that's not a reason to not send patches upstream.  projects randomly wake up all the time and do sweeps before going dormant, and if we miss that window, it won't be until the next cycle.  this has happened to us more than once.

(In reply to Joakim Tjernlund from comment #4)
> Looked in the libtool mail archive and found Debians patch here:
> https://lists.gnu.org/archive/html/libtool-patches/2019-05/msg00000.html

sounds good.  please clean up & attach the patch like normal.  posting them as bugzilla comments mangles them.
Comment 6 Joakim Tjernlund 2021-10-06 07:52:26 UTC
Created attachment 743424 [details, diff]
0055-pass-flags-unchanged.patch

Debians libtool patch for static-libasan
Comment 7 Joakim Tjernlund 2021-10-06 11:48:18 UTC
Created attachment 743532 [details]
v2: adapt to Gentoo ebuild practise

Gentoo does not rebuild ltmain.sh so it must be patched too.
Comment 8 SpanKY gentoo-dev 2021-10-06 17:06:09 UTC
we do these things in libtool itself, and in elt-patches
Comment 9 Joakim Tjernlund 2021-10-06 18:23:52 UTC
(In reply to SpanKY from comment #8)
> we do these things in libtool itself, and in elt-patches

Not sure what you mean but without ltmain.sh you get:
config.status: executing depfiles commands
config.status: executing libtool commands
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-devel/libtool-2.4.6-r6/work/libtool-2.4.6 ...
make -j8 -l6 -s 
./build-aux/inline-source './build-aux/ltmain.in' | sed -e s|@MACRO_VERSION\@|2.4.6|g -e s|@MACRO_REVISION\@|2.4.6|g -e s|@MACRO_SERIAL\@||g -e s|@PACKAGE\@|libtool|g -e s|@PACKAGE_BUGREPORT\@|bug-libtool@gnu.org|g -e s|@PACKAGE_URL\@|https://www.gnu.org/software/libtool/|g -e s|@PACKAGE_NAME\@|GNU Libtool|g -e s|@package_revision\@|2.4.6|g -e s|@PACKAGE_STRING\@|GNU Libtool 2.4.6|g -e s|@PACKAGE_TARNAME\@|libtool|g -e s|@PACKAGE_VERSION\@|2.4.6|g -e s|@VERSION\@|2.4.6|g > 'build-aux/ltmain.sh'
/bin/bash ./config.status "libtool"
config.status: executing libtool commands
Making all in .
make[2]: *** [Makefile:2416: doc/libtool.1] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1640: all-recursive] Error 1
make: *** [Makefile:1017: all] Error 2

and the other patches like libtool-2.4.6-link-fsanitize.patch also patches ltmain.sh

Anyhow, I hope you can take it from here ?
Comment 10 Joakim Tjernlund 2021-11-02 21:58:55 UTC
(In reply to SpanKY from comment #8)
> we do these things in libtool itself, and in elt-patches

Did look into elt-patches and it does not look like elt-patches is
updated anymore.

Look at the sister patch libtool-2.4.6-link-fsanitize.patch, there is
no corresponding patch in elt-patches.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-02 22:16:51 UTC
(In reply to Joakim Tjernlund from comment #10)
> (In reply to SpanKY from comment #8)
> > we do these things in libtool itself, and in elt-patches
> 
> Did look into elt-patches and it does not look like elt-patches is
> updated anymore.
> 
> Look at the sister patch libtool-2.4.6-link-fsanitize.patch, there is
> no corresponding patch in elt-patches.

Last updated in September? https://gitweb.gentoo.org/proj/elt-patches.git/
Comment 12 Joakim Tjernlund 2021-11-02 22:47:09 UTC
(In reply to Sam James from comment #11)
> (In reply to Joakim Tjernlund from comment #10)
> > (In reply to SpanKY from comment #8)
> > > we do these things in libtool itself, and in elt-patches
> > 
> > Did look into elt-patches and it does not look like elt-patches is
> > updated anymore.
> > 
> > Look at the sister patch libtool-2.4.6-link-fsanitize.patch, there is
> > no corresponding patch in elt-patches.
> 
> Last updated in September? https://gitweb.gentoo.org/proj/elt-patches.git/

wow, just 2 years after it got into libtool :)

Anyhow, attaching a dry port of the same for static-asan. Not sure
I got it right though.
Comment 13 Joakim Tjernlund 2021-11-02 22:48:13 UTC
Created attachment 748122 [details, diff]
static-asan for elt-patches
Comment 14 SpanKY gentoo-dev 2021-11-04 10:31:20 UTC
(In reply to Joakim Tjernlund from comment #12)
> wow, just 2 years after it got into libtool :)

it's updated based on demand.  if there hasn't been demand, it doesn't get updated.  only reason this latest update went in is because we needed -fuse-ld handling recently.
Comment 15 Larry the Git Cow gentoo-dev 2021-11-04 10:33:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/elt-patches.git/commit/?id=2b7112d147d2fe5d418ecdf2f8d150935761de79

commit 2b7112d147d2fe5d418ecdf2f8d150935761de79
Author:     Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
AuthorDate: 2021-11-02 22:42:18 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2021-11-04 10:33:34 +0000

    backport -static-* & -fcilkplus for 2.4.6
    
    Bug: https://bugs.gentoo.org/812026
    Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

 eltpatch.in                |  2 +-
 patches/static-flags/2.4.6 | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
Comment 16 Larry the Git Cow gentoo-dev 2021-11-04 23:18:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0be5d62afd58586c06a2d391a50a56021c30b2d6

commit 0be5d62afd58586c06a2d391a50a56021c30b2d6
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-11-04 23:10:09 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-11-04 23:18:29 +0000

    app-portage/elt-patches: add 20211104
    
    - Adds macOS Monterey / macOS 12 patch
    - backport -static-* & -fcilkplus for 2.4.6
    
    Bug: https://bugs.gentoo.org/812026
    Signed-off-by: Sam James <sam@gentoo.org>

 app-portage/elt-patches/Manifest                   |  1 +
 .../elt-patches/elt-patches-20211104.ebuild        | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-04 23:20:42 UTC
Needed to cut a release for Darwin so here we are.
Comment 18 Joakim Tjernlund 2021-11-05 10:25:01 UTC
libtool itself seems forgotten?
Comment 19 SpanKY gentoo-dev 2021-11-05 10:56:37 UTC
(In reply to Joakim Tjernlund from comment #18)

bug is still open ...
Comment 20 Joakim Tjernlund 2021-12-21 19:01:48 UTC Comment hidden (obsolete)
Comment 21 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-22 04:14:16 UTC Comment hidden (obsolete)
Comment 22 Joakim Tjernlund 2023-11-28 18:39:29 UTC Comment hidden (spam)
Comment 23 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 18:43:30 UTC
(In reply to Joakim Tjernlund from comment #22)
> Open for 2 years, closing

Please don't do that.
Comment 24 Joakim Tjernlund 2024-05-31 15:12:28 UTC
In upstream libtool master now.
Comment 25 Joakim Tjernlund 2024-07-28 13:51:50 UTC
In libtool 2.5.1
Comment 26 Joakim Tjernlund 2024-09-25 20:24:24 UTC
fixed in 2.5.3