LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-11-2011, 11:15 AM   #1
KillerCode
Member
 
Registered: Nov 2010
Posts: 57

Rep: Reputation: 0
_dl_open in libc.so?


i know that there is a function in libld.so called dlopen for share libraries loading, but i heard that there is another function called _dl_open in libc.so (which is better than libld.so sine libc is more reliable and guaranteed to exists) also if i used libc.so will be better to reduce libraries used by my software.
but i cant seem to find it in any include files :/

cheers;
thanks.
 
Old 03-11-2011, 12:04 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
/usr/lib/libc.so is a text file :
Code:
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.2 ) )

/lib/ld-linux.so.2 -> ld-2.10.1.so ( Provided by glibc ).
Code:
 $ readelf -s /lib/ld-linux.so.2 | grep dl_open
   196: 4806c750  2145 FUNC    LOCAL  DEFAULT   10 dl_open_worker
   373: 4806c250   616 FUNC    LOCAL  HIDDEN   10 _dl_open

Last edited by knudfl; 03-11-2011 at 12:08 PM.
 
Old 03-11-2011, 12:53 PM   #3
KillerCode
Member
 
Registered: Nov 2010
Posts: 57

Original Poster
Rep: Reputation: 0
i dont get it !
 
Old 03-11-2011, 02:23 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
You were looking for the object by name "_dl_open".

"_dl_open" is in the library ld-<glibc-version>.so .

'ld-linux.so.2' is a link to 'ld-<glibc-version>.so'

And that library is created when glibc is being build.


Please explain, what it is, you don't understand.

..
 
Old 03-11-2011, 02:37 PM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by KillerCode View Post
i dont get it !
A library may be an object file or a linker script.
 
1 members found this post helpful.
Old 03-12-2011, 10:23 PM   #6
KillerCode
Member
 
Registered: Nov 2010
Posts: 57

Original Poster
Rep: Reputation: 0
ok, thats new, so no _dl_open in libc? i thought because libc is already used by my app, so i can use all functions from it, and avoid linking libld.so.

so this means there is no way out? ill have to link to libld.so?
 
Old 03-14-2011, 02:20 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
so no _dl_open in libc ?
The object ""_dl_open"" is in libc only ! Nowhere else ! → → post # 2

The name of the libc library holding this object is ld-<glibc-version>.so
 
Old 03-14-2011, 08:54 AM   #8
KillerCode
Member
 
Registered: Nov 2010
Posts: 57

Original Poster
Rep: Reputation: 0
oh, so i still have to link another library? if thats the case then its pointless !!
 
Old 03-14-2011, 11:53 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
ld-<glibc-version>.so is always installed.

All binaries, including all commands depend on ld-linux.so.2 -> ld-<glibc-version>.so


..

Last edited by knudfl; 03-15-2011 at 05:27 AM.
 
1 members found this post helpful.
Old 03-30-2011, 06:09 PM   #10
wilkux
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
How can I load a library using this function and nasm, when I know the function address? I know that in eax I should store pointer to the string with new library path, in ebx mode (probably 0x80000000 | RTLD_LAZY, but why 0x80000000?), and what about ecx? What should be placed there? I found that the caller, but what it's?
 
Old 03-31-2011, 04:59 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Post #10 , @ wilkux : Welcome to LQ.

Looks like an off topic question. Please read :
http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html
http://www.linuxquestions.org/linux/rules.html

And start a new thread with your question ..
> Forums > Non-*NIX Forums > Programming >>> New Thread
http://www.linuxquestions.org/questions/programming-9/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where libc? iqbala Ubuntu 20 05-22-2008 03:22 AM
libc.so.6(GLIBC_2.3), libc.so.6(GLIBC_2.3.2) needed for Linux 7.3.1 vivek_thampy Linux - Software 1 08-09-2004 04:12 PM
libc linuxanswer Programming 7 11-17-2003 11:15 AM
libc.so.6 alperen Linux - Software 1 09-15-2003 11:46 AM
libc.so verse libc.so.5 markstevens Linux - Software 4 06-19-2003 11:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration