Manual smartlinking

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

Manual smartlinking

leledumbo
Administrator
How to manually smartlink programs? I have a bunch of units and a program entry point defined in asm file. Currently, I only link all the *.o files. Though I've used -CX, I don't think the executable is smartlinked as it is quite big. There's also a bunch of *.a generated, but I can't just rename all the *.o to libp*.a. Using -Cn, I got ppas.bat and link.res. I think I can find it out by examining link.res. But when I call ppas.bat, the resulting binaries are not the same (e.g. bigger) as if it's compiled directly.

PS: I'm cross-compiling from i386-win32 to i386-linux
Reply | Threaded
Open this post in threaded view
|

Re: Manual smartlinking

Vincent Snijders
leledumbo schreef:
> How to manually smartlink programs? I have a bunch of units and a program
> entry point defined in asm file. Currently, I only link all the *.o files.
> Though I've used -CX, I don't think the executable is smartlinked as it is
> quite big. T

The -XX compiler parameter enables smartlinking.

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

Re: Manual smartlinking

leledumbo
Administrator
Vincent Snijders wrote
The -XX compiler parameter enables smartlinking.
I know that one (and I already use it), but the problem is that I need to do it manually due to external entry point.
Reply | Threaded
Open this post in threaded view
|

Re: Manual smartlinking

Jonas Maebe-2

On 20 Aug 2008, at 07:23, leledumbo wrote:

> Vincent Snijders wrote:
>>
>> The -XX compiler parameter enables smartlinking.
>>
>
> I know that one (and I already use it), but the problem is that I  
> need to do
> it manually due to external entry point.

Pass the --gc-sections parameter to the linker (and use object files  
compiled with -CX).


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

Re: Manual smartlinking

leledumbo
Administrator
Jonas Maebe-2 wrote
Pass the --gc-sections parameter to the linker (and use object files  
compiled with -CX).
OK, I'll try. What about the *.a's?
Reply | Threaded
Open this post in threaded view
|

Re: Manual smartlinking

Jonas Maebe-2

On 20 Aug 2008, at 07:40, leledumbo wrote:

> Jonas Maebe-2 wrote:
>>
>> Pass the --gc-sections parameter to the linker (and use object files
>> compiled with -CX).
>>
> OK, I'll try. What about the *.a's?

It depends on the platform. If you have *.a, you files, you should  
link against those instead (no need to use --gc-sections in that case).


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

Re: Manual smartlinking

Jonas Maebe-2
In reply to this post by leledumbo

On 20 Aug 2008, at 07:40, leledumbo wrote:

> Jonas Maebe-2 wrote:
>>
>> Pass the --gc-sections parameter to the linker (and use object files
>> compiled with -CX).
>>
> OK, I'll try. What about the *.a's?

Or just compile with -XX -Cn, and have a look in the generated  
ppas.bat/ppas.sh and link.res files to see what the compiler does.


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

Re: Manual smartlinking

Peter Vreman
In reply to this post by leledumbo
>> Pass the --gc-sections parameter to the linker (and use object files
>> compiled with -CX).
>>
> OK, I'll try. What about the *.a's?

--gc-sectiosn will not help. FPC does not generate .o files with multiple sections for linux.
Smartlinking for linux will create libp*.a files instead. You need to link with the libp*.a
instead of the *.o files.

It can't be written down what is required for your program to link manual. But you can compile
with -s to generate a link.res and ppas.sh to see the commands that are use by fpc for linking.


Peter


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