[fpc-pascal] compile Link Smart option, is it -XX or -CX?

Tomas Hajny XHajT03 at hajny.biz
Thu Mar 3 13:10:26 CET 2016


On Thu, March 3, 2016 12:12, Dennis Poon wrote:
> Sven Barth wrote:
>> Am 03.03.2016 09:26 schrieb "Dennis" <dec12 at avidsoft.com.hk
>> <mailto:dec12 at avidsoft.com.hk>>:
>> >
>> > According to http://www.freepascal.org/docs-html/prog/progse30.html
>> >
>> > the smartlink option on the command line is -CX
>> > but in Lazarus ver 1.42,
>> >    Compilation and Linking
>> >       Linking
>> >           Link Smart is -XX
>>
>> They are different. -CX tells the compiler to compile units with smart
>> linking capability (though I'd need to check what exactly that
>> entails), while -XX enables smart linking.
>>
>>
> Would you kindly elaborate?
> If -XX is not set, does that mean Smart Link is disabled and even if -CX
> is set, it is ignored?

Let's imagine a program consisting of unit Unit1 and the main program
ProgX. You need to add -CX when compiling Unit1 (either standalone or
implicitly together with ProgX) if you want to make sure that the compiled
binary representation of Unit1 allows smartlinking its code and data (i.e.
only including the needed parts of its code and data in the final program
using this unit). When compiling a program, -XX asks the linker to perform
smartlinking for all units (including e.g. RTL units, etc.) which are
compiled in a way allowing this. -XX has no effect if the units are not
prepared in a way allowing smartlinking (i.e. not compiled with -CX). At
the same time, -CX has no effect on the final program by itself.

Hope this helps

Tomas





More information about the fpc-pascal mailing list