Skip to content

Commit 4adf975

Browse files
authored
Document compiler.libraries.ldflags property in platform specification (#840)
1 parent 99c646b commit 4adf975

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/platform-specification.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,23 @@ The recipe can be built concatenating the following automatically generated prop
189189
- `{archive_file_path}`: fully qualified archive file (ex. "/path/to/core.a"). This property was added in Arduino IDE
190190
1.6.6/arduino builder 1.0.0-beta12 as a replacement for `{build.path}/{archive_file}`.
191191
- `{archive_file}`: the name of the core archive file (ex. "core.a")
192+
- `{compiler.libraries.ldflags}`: the linking flags for precompiled libraries, which consist of automatically generated
193+
`-L` flags for the library path and `-l` flags for library files, as well as any custom flags provided via the
194+
`ldflags` field of library.properties. In order to support precompiled libraries, platform.txt must contain a
195+
definition of `compiler.libraries.ldflags`, to which any automatically generated flags will be appended. Support for
196+
precompiled libraries was added in Arduino IDE 1.8.6/arduino-builder 1.4.0.
192197

193198
For example the following is used for AVR:
194199

195200
compiler.c.elf.flags=-Os -Wl,--gc-sections
196201
compiler.c.elf.cmd=avr-gcc
197202

203+
compiler.libraries.ldflags=
204+
198205
[......]
199206

200207
## Combine gc-sections, archives, and objects
201-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{archive_file_path}" "-L{build.path}" -lm
208+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} "{archive_file_path}" "-L{build.path}" -lm
202209

203210
#### Recipes for extraction of executable files and other binary data
204211

0 commit comments

Comments
 (0)