From: ÈîÑÇƽ <ruan_yaping@pku.org.cn>
To: gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org>
Subject: problem: symbol resolution in shared library
Date: Sun, 30 Jul 2006 10:09:00 -0000 [thread overview]
Message-ID: <20060730100900.Fof03dSZYJD_EnpoO1-OKfs6wWchPF2tGI8GKQqJ9ts@z> (raw)
Hi,
I am using SuseLinux9, I am facing the following problems, can you please help any body.
Problem 1:-
Main Program A:test2() redefined private version: strcpy(), malloc().
Shared LibrayB:test1() test2()
A:
strcpy() {...}
mlloc() {....}
test2() {...}
main() { test1();}
B:test1 ,test2 in two translate unit.
test1() { test2(); strcpy(...) ; malloc(....);}
test2(){...}
A,B static linked.
I noticed that the call to test2 and malloc in test1,goto the define in A. and the call to
strcpy remain to the one in libc.so.
I have heart the malloc/free is using a func pointer to forward to the one in A (malloc hack) .
My question is : is any reference to symbol in libc.so(except malloc/free) were permanently binded and other symbol(even the symbol exist in the same lib) delayed to load time ?
Problem 2:-
x) Similarly, if A, B dynamic linked(use dlopen(RTLD_NOW,RTLD_GLOBAL)), the call to test2 in test1 goto the define in A.
y) but if I delete the test2 definition in B, when use dlopen to load B, there will be error, reference to test2 can't be
resolution.
This confused me , I don't use -rdynamic in compile A, that means y) is correct, but why x) present?
Thanks,
Stephen
ruan_yaping@pku.org.cn
next reply other threads:[~2006-07-30 10:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-30 10:09 ÈîÑÇƽ [this message]
2006-07-30 10:09 ÈîÑÇƽ
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=20060730100900.Fof03dSZYJD_EnpoO1-OKfs6wWchPF2tGI8GKQqJ9ts@z \
--to=ruan_yaping@pku.org.cn \
--cc=gcc-help@gcc.gnu.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).