[fpc-pascal] Smart link in FreeBSD multi-arch ?

fredvs fiens at hotmail.com
Thu Oct 13 19:48:28 CEST 2016


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 https://sourceware.org/binutils/docs/ld/Options.html:

--gc-sections
--no-gc-sections
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
experimental.
`--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
script.

___________________

There, in FreeBSD forum, they do not agree.

https://forums.freebsd.org/threads/57931/page-3

Fre;D







-----
Many thanks ;-)
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Smart-link-in-FreeBSD-multi-arch-tp5726375p5726567.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list