From: Sergey Vlasov <vsu@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] libstdc++4.1-devel сломан?
Date: Fri, 2 Jun 2006 18:01:48 +0400
Message-ID: <20060602140148.GB7502@master.mivlgu.local> (raw)
In-Reply-To: <20060602131757.GB4604@basalt.office.altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]
On Fri, Jun 02, 2006 at 05:17:57PM +0400, Dmitry V. Levin wrote:
> > $ cat test.c
> > test()
> > {
> > no_such_function();
> > }
> > $ gcc -shared -fPIC -o libtest.so test.c
> > $ ls -l libtest.so
> > -rwxr-xr-x 1 at at 5591 Jun 2 14:54 libtest.so
> > $ gcc -shared -fPIC -o libtest.so test.c -Wl,-z,defs
> > /tmp/.private/at/ccCRSta9.o: In function `test':
> > test.c:(.text+0x14): undefined reference to `no_such_function'
> > collect2: ld returned 1 exit status
> > $
>
> Ну и что? Часть символов живёт в ld.so и тем самым делает -Wl,-z,defs
> малопригодным на практике.
$ cat test_exceptions.cpp
int main(int argc, char **argv)
{
throw 0;
}
Вот это работает:
$ gcc -Wl,-z,defs -o test_exceptions test_exceptions.cpp -lsupc++
При этом получаемый исполняемый файл содержит ld-linux.so.2 в DT_NEEDED
(чего обычно не происходит).
А вот это уже не работает:
$ gcc -Wl,-z,defs -shared -fPIC -o test_exceptions.so test_exceptions.cpp -lsupc++
/usr/lib/gcc/i586-alt-linux/4.1.0/libsupc++.a(eh_globals.o): In function `__gnu_internal::get_global()':
eh_globals.cc:(.text._ZN14__gnu_internal10get_globalEv+0x17): undefined reference to `___tls_get_addr'
collect2: ld returned 1 exit status
Другой вопрос - зачем может быть нужно линковать разделяемую библиотеку с
libsupc++.a, создавая тем самым как минимум дублирование кода. Если
использовать нормальную разделяемую libstdc++, никаких проблем с
-Wl,-z,defs не возникает.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2006-06-02 14:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-01 15:36 Valery V. Inozemtsev
2006-06-01 15:43 ` Dmitry V. Levin
2006-06-01 16:23 ` Valery V. Inozemtsev
2006-06-01 16:41 ` Alexey Tourbin
2006-06-02 7:47 ` Damir Shayhutdinov
2006-06-02 11:00 ` Alexey Tourbin
2006-06-02 13:17 ` Dmitry V. Levin
2006-06-02 13:54 ` Alexey Tourbin
2006-06-02 14:02 ` Dmitry V. Levin
2006-06-02 14:25 ` Alexey Tourbin
2006-06-02 14:01 ` Sergey Vlasov [this message]
2006-06-02 14:06 ` Dmitry V. Levin
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=20060602140148.GB7502@master.mivlgu.local \
--to=vsu@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