Thanks Graeme.

To know what is sent to the linker, there is the -s parameter.

# fpc -XX -s test.pas

This will compile the object and create a script file for the linker.
Here the script with -XX parameter:

/usr/bin/ld -b elf32-i386-freebsd -m elf_i386_fbsd *--gc-sections* -s -L. -0
./test ./link.res

If seems to me then that *--gc-sections* has to do with smart-link too.

>From site

Enable garbage collection of unused input sections. It is ignored on targets
that do not support this option. The default behaviour (of not performing
this garbage collection) can be restored by specifying `--no-gc-sections' on
the command line. Note that garbage collection for COFF and PE format
targets is supported, but the implementation is currently considered to be
`--gc-sections' decides which input sections are used by examining symbols
and relocations. The section containing the entry symbol and all sections
containing symbols undefined on the command-line will be kept, as will
sections containing symbols referenced by dynamic objects. Note that when
building shared libraries, the linker must assume that any visible symbol is
referenced. Once this initial set of sections has been determined, the
linker recursively marks as used any section referenced by their
relocations. See `--entry' and `--undefined'.

This option can be set when doing a partial link (enabled with option `-r').
In this case the root of symbols kept must be explicitly specified either by
an `--entry' or `--undefined' option or by a ENTRY command in the linker


There, in FreeBSD forum, they do not agree.


Many thanks ;-)
View this message in context:
Sent from the Free Pascal - General mailing list archive at
fpc-pascal maillist  -

Reply via email to