Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-03

Equivalent of Delphi map files...

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

m utku

Hello again :), I just forgot to ask; Delphi has an option to generate a so called "map file" that contains the function addresses matched with the function names when an executable compiled. What would be the equivalent FPC functionality for this?

Regards,
Utku.

Jonas Maebe
to m utku
m utku wrote
Hello again :), I just forgot to ask; Delphi has an option to generate a so called "map file" that contains the function addresses matched with the function names when an executable compiled. What would be the equivalent FPC functionality for this?

man ld -> search for "map" -> there is a "--print-map" option -> tell FPC to pass this option to ld using FPC's -k option:

-k--print-map

Jonas

Vincent Snijders
to Jonas Maebe
Jonas Maebe wrote 12 lines
On 02 Mar 2007, at 09:03, m utku wrote: > Hello again :), I just forgot to ask; Delphi has an option to generate > a so called "map file" that contains the function addresses matched > with the function names when an executable compiled. What would be the > equivalent FPC functionality for this? man ld -> search for "map" -> there is a "--print-map" option -> tell FPC to pass this option to ld using FPC's -k option: -k--print-map

At least on windows a map file can be generated with the fpc compiler option -Xm

Vincent

Vinzent Hoefler
to Jonas Maebe: man ld -> search for "map" -> there is a "--print-map" option -> tell FPC to pass this…
Jonas Maebe wrote 10 lines
On 02 Mar 2007, at 09:03, m utku wrote: > Hello again :), I just forgot to ask; Delphi has an option to > generate a so called "map file" that contains the function > addresses matched with the function names when an executable > compiled. What would be the equivalent FPC functionality for this? man ld -> search for "map" -> there is a "--print-map" option -> tell FPC to pass this option to ld using FPC's -k option: -k--print-map

Hmm. And then how to redirect the linker's standard output to a file named the same as a the source?

Vinzent.

Jonas Maebe
to Vincent Snijders: At least on windows a map file can be generated with the fpc compiler option -Xm Vincent
Vincent Snijders wrote 12 lines
Jonas Maebe schreef: > On 02 Mar 2007, at 09:03, m utku wrote: >> Hello again :), I just forgot to ask; Delphi has an option to >> generate a so called "map file" that contains the function >> addresses matched with the function names when an executable >> compiled. What would be the equivalent FPC functionality for this? > man ld -> search for "map" -> there is a "--print-map" option -> > tell FPC to pass this option to ld using FPC's -k option: > -k--print-map At least on windows a map file can be generated with the fpc compiler option -Xm

In his previous post he mentioned he's using Debian Sarge.

Jonas

Jonas Maebe
to Vinzent Hoefler: Hmm. And then how to redirect the linker's standard output to a file named the same as a…
Vinzent Hoefler wrote 7 lines
> man ld -> search for "map" -> there is a "--print-map" option -> tell > FPC to pass this option to ld using FPC's -k option: > > -k--print-map Hmm. And then how to redirect the linker's standard output to a file named the same as a the source?

You have to manually redirect the output to where you want it to got. Since linking happens on a per-program/library basis and not on a per- unit basis, it isn't that difficult to do this.

Jonas

Jonas Maebe
to Jonas Maebe
Jonas Maebe wrote 8 lines
>> -k--print-map > > Hmm. And then how to redirect the linker's standard output to a file > named the same as a the source? You have to manually redirect the output to where you want it to got. Since linking happens on a per-program/library basis and not on a per-unit basis, it isn't that difficult to do this.

Or you can search a bit further in the man page until you arrive at this option:

-Map mapfile
Print a link map to the file mapfile. See the
description of the
-M option, above.

-k"-Map mapfile"

Jonas

Vincent Snijders
to Jonas Maebe: In his previous post he mentioned he's using Debian Sarge. Jonas
Jonas Maebe wrote 19 lines
On 02 Mar 2007, at 09:26, Vincent Snijders wrote: > Jonas Maebe schreef: >> On 02 Mar 2007, at 09:03, m utku wrote: >>> Hello again :), I just forgot to ask; Delphi has an option to >>> generate a so called "map file" that contains the function addresses >>> matched with the function names when an executable compiled. What >>> would be the equivalent FPC functionality for this? >> man ld -> search for "map" -> there is a "--print-map" option -> tell >> FPC to pass this option to ld using FPC's -k option: >> -k--print-map > > At least on windows a map file can be generated with the fpc compiler > option -Xm In his previous post he mentioned he's using Debian Sarge.

Yes, I was aware of that. That is why I mentioned I had used it on windows.

For fun I did a
make OPT="-Xm"
in the lazarus example directory on i386-linux with OpenSuse 10.1 and I got this: -rw-r--r-- 1 vsds users 3360519 2007-03-02 09:36 hello.map

So it seems to work outside windows too.

Vincent

Peter Vreman
to Vincent Snijders
Show quoted text 21 lines
>>>>Hello again :), I just forgot to ask; Delphi has an option to >>>>generate a so called "map file" that contains the function >>>>addresses matched with the function names when an executable >>>>compiled. What would be the equivalent FPC functionality for this? >>>man ld -> search for "map" -> there is a "--print-map" option -> >>>tell FPC to pass this option to ld using FPC's -k option: >>>-k--print-map >> >>At least on windows a map file can be generated with the fpc >>compiler option -Xm >In his previous post he mentioned he's using Debian Sarge. Yes, I was aware of that. That is why I mentioned I had used it on windows. For fun I did a make OPT="-Xm" in the lazarus example directory on i386-linux with OpenSuse 10.1 and I got this: -rw-r--r-- 1 vsds users 3360519 2007-03-02 09:36 hello.map So it seems to work outside windows too.

The -Xm is 2.1.1 only and not available in 2.0.x. The -Xm is also available for linux and can be added for other platforms if needed and the linker supports it.

Peter

Adriaan van Os
to Peter Vreman
Peter Vreman wrote
The -Xm is 2.1.1 only and not available in 2.0.x. The -Xm is also available for linux and can be added for other platforms if needed and the linker supports it.

Is -Xm supposed to work on Mac OS X ? I don't see any file being generated, nor do I get an error message. The linker has

-map map_file_path
Writes a map file to the specified path which details all symbols and their addresses in the output image.

and using for example -k"-map link-map.txt" works. It's not a big issue, but I suggest to either implement -Xm (if not already) or to remove it from the list of available options.

Regards,

Adriaan van Os