[fpc-pascal] Smartlinking while cross compiling
Brad Campbell
brad at wasp.net.au
Wed Oct 8 10:51:29 CEST 2008
Jonas Maebe wrote:
>
> On 08 Oct 2008, at 09:15, Brad Campbell wrote:
>
>> I'm cross compiling from i386-linux to
>> i386-darwin/powerpc-darwin/i386-win32. I can't seem to create
>> smartlinkable libraries for anything other than i386-linux and so all
>> my cross compiled files are suddenly huge by comparison.
>>
>> I thought I had this working. Everything is compiled with -CX -XX, but
>> I only have .a files in my i386-linux directory, and my -va compile
>> logs from the other architectures all say..
>>
>> unit STRUTILS can't be smart linked, switching to static linking
>> [7.082] Searching file
>> /opt/cross/lib/fpc/2.2.3/units/powerpc-darwin/rtl/strutils.o... found
>
> Smart linking does not happen using .a files on Darwin. Smart linking is
> performed by the Darwin linker (as of the one included with Xcode 1.5
> and higher) using the plain .o files. All that needs to be done is to
> add ".subsections_via_symbols" at the end of an assembler file (which
> FPC does when you use -CX) and pass -dead_strip to the linker when
> linking (which FPC does when you use -XX).
>
> Please file a bug to have this warning only shown for Darwin in case a
> unit has been compiled without -CX.
>
> I have no idea why it wouldn't work if you cross-compile, since as
> explained it's just a matter of having a single line in the assembler
> files and passing a parameter to the linker.
I've looked at it further, and whilst it tells me it's not smartlinking, filesize says otherwise.
This is native on a G4, but cross compiling shows the same results.
macppc:~ user$ fpc -Xs test -va | grep "smart link"
macppc:~ user$ ls -la test
-rwxr-xr-x 1 user user 240252 Oct 8 12:48 test
macppc:~ user$ fpc -XX -Xs test -va | grep "smart link"
[0.293] unit HELLO can't be smart linked, switching to static linking
[0.293] unit SYSTEM can't be smart linked, switching to static linking
macppc:~ user$ ls -la test
-rwxr-xr-x 1 user user 107840 Oct 8 12:48 test
macppc:~ user$ fpc
Free Pascal Compiler version 2.2.3 [2008/06/14] for powerpc
Copyright (c) 1993-2008 by Florian Klaempfl
/usr/local/bin/ppcppc [options] <inputfile> [options]
This was a snapshot I downloaded some time back. My cross compiler exhibits the same behaviour.
So it appears that while the compiler complains and states it's going to static link, it looks like
it's smartlinking in any case.
I will file a bug as you requested. Thanks for the input yet again :)
Brad
--
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
More information about the fpc-pascal
mailing list