Gentoo Archives: gentoo-dev

From: Andreas Fink <finkandreas@×××.de>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] as-needed patch for ltmain.sh
Date: Thu, 01 Feb 2018 10:56:05
Message-Id: 20180201115546.6daed439@web.de
1 Hello,
2 I have a question to the patch provided by the package
3 app-portage/elt-patches, namely the file as-needed/2.4.3
4
5 Here I can see the following being added to ltmain.sh:
6 + -Wl,--as-needed|-Wl,--no-as-needed)
7 + deplibs="$deplibs $arg"
8 + continue
9 + ;;
10 +
11
12 In my understanding the order must be the opposite otherwise it has no
13 effect to $deplibs, i.e. the line should be deplibs="$arg $deplibs".
14 From the man page of ld I read:
15 This option affects ELF DT_NEEDED tags for dynamic libraries mentioned
16 on the command line after the --as-needed option.
17
18 If we add the flag after deplibs it's mostly not in effect at all.
19
20 I realized that the flag is uneffective building claws-mail which links
21 in the end to the library libnsl, although this dependency is
22 unnecessary, which can be seen with
23 ldd -u -r $(which claws-mail)
24 Unused direct dependencies:
25 /usr/lib64/libgthread-2.0.so.0
26 /usr/lib64/libatk-1.0.so.0
27 /usr/lib64/libpangoft2-1.0.so.0
28 /usr/lib64/libfontconfig.so.1
29 /usr/lib64/libfreetype.so.6
30 /usr/lib64/libnsl.so.2
31 /usr/lib64/libdbus-1.so.3
32
33 The link command used to build claws-mail when it is being installed using emerge is:
34 libtool: link: x86_64-pc-linux-gnu-gcc -mtune=generic -O2 -pipe -Wno-unused-function -Wno-pointer-sign -Wall -Wl,-O1 -Wl,--export-dynamic -o claws-mail account.o action.o addrcache.o addr_compl.o addressadd.o addrgather.o addrharvest.o addritem.o advsearch.o alertpanel.o autofaces.o avatars.o codeconv.o compose.o crash.o customheader.o displayheader.o edittags.o enriched.o entity.o export.o file_checker.o filtering.o folder.o folder_item_prefs.o foldersel.o folderutils.o folderview.o grouplistdialog.o headerview.o html.o image_viewer.o imap.o imap_gtk.o import.o inc.o localfolder.o main.o mainwindow.o manual.o matcher.o matcher_parser_lex.o matcher_parser_parse.o mbox.o message_search.o messageview.o mh.o mh_gtk.o mimeview.o msgcache.o news.o news_gtk.o noticeview.o partial_download.o password.o password_gtk.o passwordstore.o pop.o prefs_account.o prefs_actions.o prefs_common.o prefs_compose_writing.o prefs_customheader.o prefs_display_header.o prefs_ext_prog.o prefs_filtering_action.o prefs_filtering.o prefs_folder_item.o prefs_fonts.o prefs_gtk.o prefs_image_viewer.o prefs_logging.o prefs_matcher.o prefs_message.o prefs_migration.o prefs_msg_colors.o prefs_other.o prefs_quote.o prefs_receive.o prefs_send.o prefs_spelling.o prefs_summaries.o prefs_summary_column.o prefs_summary_open.o prefs_folder_column.o prefs_template.o prefs_themes.o prefs_toolbar.o prefs_wrapping.o printing.o privacy.o procheader.o procmime.o procmsg.o quote_fmt.o quote_fmt_lex.o quote_fmt_parse.o recv.o remotefolder.o send_message.o setup.o sourcewindow.o ssl_manager.o statusbar.o stock_pixmap.o summary_search.o summaryview.o textview.o toolbar.o undo.o unmime.o uri_opener.o wizard.o addrbook.o addrclip.o addrcustomattr.o addressbook.o addressbook_foldersel.o addrindex.o addrquery.o addrselect.o addrduplicates.o browseldap.o editaddress.o editaddress_other_attributes_ldap.o editbook.o editgroup.o editjpilot.o editldap_basedn.o editldap.o editvcard.o exphtmldlg.o expldifdlg.o exporthtml.o exportldif.o importldif.o importmutt.o importpine.o jpilot.o ldapctrl.o ldaplocate.o ldapquery.o ldapserver.o ldapupdate.o ldaputil.o ldif.o mutt.o pine.o vcard.o -Wl,-O1 -pthread -Wl,-O1 -pthread etpan/.libs/libclawsetpan.a -L/usr/lib64 gtk/.libs/libclawsgtk.a -lgmodule-2.0 -lgthread-2.0 -lcrypt -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype -lnsl -llber -lldap -lgnutls -lpthread -lstartup-notification-1 -ldbus-glib-1 -ldbus-1 -lrsvg-2 -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lcairo -lm -letpan -Wl,--as-needed -lssl -lcrypto -lz -pthread
35
36 As you can see the flag --as-needed is passed rather late on the
37 commandline pulling in libnsl in the final build. Passing it earlier on
38 the commandline, removes the dependency on libnsl. I know that it is a
39 "bug" of claws-mail pulling in libnsl in the first place if it is not
40 needed at all. But I am wondering about the order of deplibs and arg in
41 the above mentioned patch, that is applied in the end to a lot of
42 ebuilds. I assume claws-mail is not the only package suffering from a
43 useless --as-needed flag, since it's passed way too late.
44
45 Cheers
46 Andreas

Replies

Subject Author
Re: [gentoo-dev] as-needed patch for ltmain.sh James Le Cuirot <chewi@g.o>