Equivalent of Delphi map files...

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Equivalent of Delphi map files...

M. Utku Karataş
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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Jonas Maebe-2

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


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Vincent Snijders
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

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Vinzent Höfler
In reply to this post by Jonas Maebe-2
On Friday 02 March 2007 08:19, Jonas Maebe wrote:

> 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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Jonas Maebe-2
In reply to this post by Vincent Snijders

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.


Jonas

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

M. Utku Karataş
In reply to this post by M. Utku Karataş

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

Vinzent, passing this: "-k-Map mapfile" to fpc does the trick. Thanks to
Jonas...

Regards,
Utku.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Jonas Maebe-2
In reply to this post by Vinzent Höfler

On 02 Mar 2007, at 09:29, Vinzent Hoefler wrote:

>> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Jonas Maebe-2

On 02 Mar 2007, at 09:32, Jonas Maebe wrote:

>>> -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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Vincent Snijders
In reply to this post by Jonas Maebe-2
Jonas Maebe schreef:

>
> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Peter Vreman

>>>>>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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent of Delphi map files...

Adriaan van Os-2
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal