469,576 Members | 1,785 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

what does libm.a contain?

when I did a dir libm.a on my m/c I was surprised to find the size of
the file is only about 500 bytes. What does it contain? And from which
file does the math code actually come from? I have MinGW setup on my m/
c
Jun 27 '08 #1
4 7773
On 26 Jun 2008 at 20:14, fd*****@gmail.com wrote:
when I did a dir libm.a on my m/c I was surprised to find the size of
the file is only about 500 bytes. What does it contain? And from which
file does the math code actually come from? I have MinGW setup on my m/
c
Why not extract it (ar -x) and see? You can see what symbols are in the
resulting object files by using a program like nm.

500 bytes does seem somewhat small for libm! Guess: the math library is
linked automatically under the Mingw compiler system, and this is a
"dummy library" that only exists to make typical *nix/gcc Makefiles with
"-lm" command lines still work.

Jun 27 '08 #2
Antoninus Twink wrote:
On 26 Jun 2008 at 20:14, fd*****@gmail.com wrote:
>when I did a dir libm.a on my m/c I was surprised to find the size of
the file is only about 500 bytes. What does it contain? And from which
file does the math code actually come from? I have MinGW setup on my m/
c

Why not extract it (ar -x) and see? You can see what symbols are in the
resulting object files by using a program like nm.

500 bytes does seem somewhat small for libm! Guess: the math library is
linked automatically under the Mingw compiler system, and this is a
"dummy library" that only exists to make typical *nix/gcc Makefiles with
"-lm" command lines still work.
Using lcc-win to dump the contents of libm.a conforms your
theory:
Contents of libm.a 492 bytes
Archive header:1
Name:'/ '
Date:' 941967385 (Sun Nov 07 10:36:25 1999) '
User id:'0 '
Group id:'0 '
File Mode:'0 '
File Size:'4 '

First linker member
----- ------ ------
0 (0) symbols contained in the archive <---------look at this

Archive header:2
Name:'_libm_dummy.o/ '
Date:' 941967385 (Sun Nov 07 10:36:25 1999) '
User id:'108 '
Group id:'101 '
File Mode:'100644 '
File Size:'359 '
Offset in file 132 Dump of object file _libm_dummy.o/

Section Table
01 .text PhysAddr: 00000000 VirtAddr: 00000000 0x00000000
raw data offs: 00000 raw data size: 00000 (1 pages)
// 0 bytes for text

02 .data PhysAddr: 00000000 VirtAddr: 00000000 0x00000000
raw data offs: 00000 raw data size: 00000 (1 pages)
// O bytes for data

03 .bss PhysAddr: 00000016 VirtAddr: 00000000 0x00000000
raw data offs: 00000 raw data size: 00000 (1 pages)
// 0 bytes for bss


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jun 27 '08 #3
fd*****@gmail.com wrote:
when I did a dir libm.a on my m/c I was surprised to find the size of
the file is only about 500 bytes. What does it contain? And from which
file does the math code actually come from? I have MinGW setup on my m/
c
libm.a is an implementation detail and thus off-topic here.

<OT>
Some systems put large/complex math functions in a separate library
called libm, others put them in the standard library called libc. Your
system appears to have an empty libm, which is likely so that programs
specified to link with libm on other platforms (where it's required)
will also link properly on your system (where it's not). There are
other possible explanations as well.
</OT>

S
Jun 27 '08 #4
On Thu, 26 Jun 2008 16:06:34 -0500, Stephen Sprunk
<st*****@sprunk.orgwrote:
fd*****@gmail.com wrote:
when I did a dir libm.a on my m/c I was surprised to find the size of
the file is only about 500 bytes. What does it contain? And from which
file does the math code actually come from? I have MinGW setup on my m/
c

libm.a is an implementation detail and thus off-topic here.

<OT>
Some systems put large/complex math functions in a separate library
called libm, others put them in the standard library called libc. Your
system appears to have an empty libm, which is likely so that programs
specified to link with libm on other platforms (where it's required)
will also link properly on your system (where it's not). There are
other possible explanations as well.
</OT>
<still OT>
MingW in particular uses the Microsoft library (more specifically, the
older-version but universally deployed DLL nondebug library) MSVCRT
for most of its library functionality, adding and replacing (mostly in
libmingwex) those routines that are not (consistently) provided or not
(always) correct in MSVCRT. MSVCRT does not separate math from
nonmath, and so it would not make sense for MingW to do so.
</>

- formerly david.thompson1 || achar(64) || worldnet.att.net
Jul 7 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

75 posts views Thread by Beni | last post: by
7 posts views Thread by storyGerald | last post: by
2 posts views Thread by Mikus Sleiners | last post: by
5 posts views Thread by rembremading | last post: by
1 post views Thread by tilley.rb | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.