Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to understand the linker map file?

5,476 views
Skip to first unread message

Steven Woody

unread,
Mar 28, 2007, 2:27:35 AM3/28/07
to
hi,

by passing -Wl,-Map=mapfile to gcc, i got a map file in linking stage.
but how to understand the file? is there a document descripting its
contents?

thanks.

-
woody

Paul Pluzhnikov

unread,
Mar 28, 2007, 10:40:49 AM3/28/07
to
"Steven Woody" <narke...@gmail.com> writes:

> by passing -Wl,-Map=mapfile to gcc, i got a map file in linking stage.
> but how to understand the file? is there a document descripting its
> contents?

I believe the file is supposed to be self-explanatory, provided
you have basic understanding of how linkers work, and the object
file format on your platform.

If you do not have such understanding, the document you seek (if
it exists) will not help you (much).

Some further reading: http://www.iecc.com/linker/

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

sweet...@gmail.com

unread,
Sep 21, 2012, 11:12:17 AM9/21/12
to
Old posts but i hadn't found anything closer to my matter.

Does any one know how to obtained .map file sorted by address?

> by passing -Wl,-Map=mapfile to gcc, i got a map file in linking stage.

For me it generates something like this

...
.text 0x004013b0 0x3c28 ./release/Logger.o
0x00401bf4 LogScope::flush()
0x004018b8 Logger::~Logger()
0x00403b50 Logger::Logger()
0x00401af8 LogScope::LogScope(std::string const&, libnbs::LogScope const*)
0x00401a50 LogScope::LogScope(std::string const&, libnbs::LogScope const&)
0x00401460 LogScope::LogScope(std::string const&, libnbs::LogScope const&)
...
.text 0x00404fd8 0x17dc ./release/Debug.o
...

Indeed I have Logger.cpp and Debug.cpp files and the functions listed are there.

In LogScope(&,*) i added:
int *a = NULL;
*a = 5;
and crash shows me (it is mingw anyway):
0x401b14 <+0x0000> movl $0x5,0x0
After sorting objects from Logger.o, I can guess that fail indeed comes from LogScope(&,*).

But the first look is quite confusing.

So my question again.
How to obtain address sorted .map file from ld?
0 new messages