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