From: Alexey Tourbin <at@altlinux.ru>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] Q: --copy-dt-needed-entries
Date: Sun, 21 Mar 2010 17:51:13 +0300
Message-ID: <20100321145113.GD30094@altlinux.org> (raw)
In-Reply-To: <20100321131440.GA1931@wo.int.altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 3754 bytes --]
On Sun, Mar 21, 2010 at 04:14:41PM +0300, Dmitry V. Levin wrote:
> On Sun, Mar 21, 2010 at 01:19:10PM +0300, Evgeny Sinelnikov wrote:
> > 21 марта 2010 г. 13:11 пользователь Andrey Rahmatullin написал:
> > > On Sun, Mar 21, 2010 at 01:04:53PM +0300, Stanislav Ievlev wrote:
> > >> >> Вместо того чтобы усовершенствовать систему библиотек откатывают
> > >> >> разработку на C на уровень прошлого столетия.
> > >> > А в чём регрессия? Что и как стоит усовершенствовать?
> > >> Я бы предпочёл не знать, с кем там линкуется библиотека, которую я использую.
> >
> > Так тут ведь и не предлагают знать. Наоборот, предлагают ещё и не
> > линковаться явно с той библиотекой, которую ты используешь, если её
> > использует другая библиотека, которую ты тоже используешь.
> >
> > > А при чём тут? Речь о том, что если ты используешь библиотеку, тебе
> > > обязательно надо линковаться с ней явно.
> >
> > Ну, да...
>
> --copy-dt-needed-entries можно рассматривать как дополнение к --as-needed:
>
> Первый параметр заставляет линковать свою программу со всеми
> библиотеками, котрые эта программа непосредственно использует.
In ld(1) manpage, perhaps the description is not quite clear. And we
should strive for very accurate wording in order to avoid a total mess.
(E.g. we'd better avoid anthropomorphic clauses like "zastavlyaet".)
| --copy-dt-needed-entries
| --no-copy-dt-needed-entries
| This option affects the treatment of dynamic libraries
| referred to by DT_NEEDED tags inside ELF dynamic libraries
| mentioned on the command line. Normally the linker will add
| a DT_NEEDED tag to the output binary for each library
| mentioned in a DT_NEEDED tag in an input dynamic library.
So, "normally" what's happening is something like a "shallow closure".
E.g. when I link with libgtk+2, glib2 is going to be linked in, too,
automatically.
| With --no-copy-dt-needed-entries specified on the command
| line however any dynamic libraries that follow it will have
| their DT_NEEDED entries ignored. The default behaviour can
| be restored with --copy-dt-needed-entries.
So --copy-dt-needed-entries is the default - which is to link in more
dependencies automatically; --no-copy-dt-needed-entries reverts this
logic to its bare minimum - only what you specified on the command line
gets actually linked in (so you must specify e.g. both libgtk+2 and glib2).
| This option also has an effect on the resolution of symbols in
| dynamic libraries. With the default setting dynamic libraries
| mentioned on the command line will be recursively searched,
| following their DT_NEEDED tags to other libraries, in
| order to resolve symbols required by the output binary. With
| --no-copy-dt-needed-entries specified however the searching of
| dynamic libraries that follow it will stop with the dynamic
| library itself. No DT_NEEDED links will be traversed to
| resolve symbols.
Again, "this option also has an effect on the resolution of symbols"
is a poor wording. Does this option affect only DT_NEEDED entries,
or does it also set some other flags in the output binary? Does this
paragraph address the ld(1) behaviour or rather ld.so(8) behaviour?
> Второй параметр не дает слинковать свою программу с библиотеками, которые
> эта программа не использует непосредственно.
>
> В результате программа должна получиться слинкованной с теми и только с
> теми библиотеками, которые она непосредственно использует, т.е. должна
> произойти правильная оптимальная линковка.
So, contrary to the initial message, with --as-needed on, there seems
to be NO REASON to enable --no-copy-dt-needed-entries by default.
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2010-03-21 14:51 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 22:14 [devel] Q: --no-add-needed Kirill A. Shutemov
2010-03-18 22:22 ` Dmitry V. Levin
2010-03-19 0:36 ` Max Ivanov
2010-03-19 8:40 ` Kirill A. Shutemov
2010-03-19 12:29 ` Max Ivanov
2010-03-19 12:51 ` Kirill A. Shutemov
2010-03-19 20:49 ` Dmitry V. Levin
2010-03-19 21:24 ` Kirill A. Shutemov
2010-03-21 9:54 ` Stanislav Ievlev
2010-03-21 10:02 ` Evgeny Sinelnikov
2010-03-21 10:04 ` Stanislav Ievlev
2010-03-21 10:11 ` Andrey Rahmatullin
2010-03-21 10:19 ` Evgeny Sinelnikov
2010-03-21 13:14 ` [devel] Q: --copy-dt-needed-entries Dmitry V. Levin
2010-03-21 14:51 ` Alexey Tourbin [this message]
2010-03-21 15:34 ` [devel] Q: --no-copy-dt-needed-entries Dmitry V. Levin
2010-03-21 19:18 ` Alexey Tourbin
2010-03-22 0:26 ` Kirill A. Shutemov
2010-03-22 0:27 ` Kirill A. Shutemov
2010-03-22 8:11 ` Alexey Tourbin
2010-03-22 11:00 ` Kirill A. Shutemov
2010-03-22 13:58 ` Alexey Tourbin
2010-03-22 15:41 ` Kirill A. Shutemov
2010-03-22 17:19 ` Alexey Tourbin
2010-03-22 18:31 ` Kirill A. Shutemov
2010-03-22 14:15 ` Sergei Epiphanov
2010-03-22 14:31 ` Vitaly Kuznetsov
2010-03-22 14:41 ` Kirill A. Shutemov
2010-03-22 7:23 ` [devel] Q: --no-copy-dt-needed-entries. " Любит-не =?windows-1251?b?IOv+4ejy?=". И? Sergei Epiphanov
2010-03-22 7:28 ` Kirill A. Shutemov
2010-03-22 8:23 ` Alexey Tourbin
2010-03-24 18:04 ` [devel] Q: --no-copy-dt-needed-entries Dmitry V. Levin
2010-03-24 18:24 ` Alexey Tourbin
2010-03-24 19:01 ` Kirill A. Shutemov
2010-03-24 22:01 ` Dmitry V. Levin
2010-03-25 17:14 ` Michael Shigorin
2010-03-24 18:15 ` Dmitry V. Levin
2010-03-24 18:24 ` Kirill A. Shutemov
2010-03-24 18:28 ` Dmitry V. Levin
2010-03-24 18:40 ` Kirill A. Shutemov
2010-03-22 14:48 ` [devel] Q: --no-add-needed Stanislav Ievlev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100321145113.GD30094@altlinux.org \
--to=at@altlinux.ru \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git