Skip to content

Commit

Permalink
Fix documentation for linkgroups (#2369)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickclark2016 authored Dec 10, 2024
1 parent a861320 commit 8c84447
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions website/docs/linkgroups.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
Turns on/off linkgroups for gcc/clang in the gmake backend.
Turns on or off the linkgroups for option for linked libraries.

Notes:

Projects using GCC or Clang will use order dependent linking by default with the default linker. While it is generally believed to be slower, this option enables order independent linking within a group of libraries by putting them inside of a link-group using the `-Wl,--start-group` and `-Wl,--end-group` linker command line arguments.

```lua
linkgroups ("value")
```

### Parameters ###

`value` is a boolean value, i.e. "On" or "Off".
`value` is one of:

| Value | Description |
|---------|---------------------------------------------------|
| On | Turn on link groups. |
| Off | Turn off link groups. |

### Applies To ###

Project configurations

### Availability ###

When linking against another projects or libraries gcc/clang by default have order dependent linking, at least with the general default linker. While it is generally believed to be slower, you can enable order independent linking within a group of libraries by putting them inside of a link-group using the -Wl,--start-group and -Wl,--end-group command line arguments.
Premake 5.0-alpha10 or later. GCC and Clang toolsets only. Codelite, gmake, and gmake2 exporters only.

### Examples ###

```lua
project "A"
kind "StaticLib"

project "B"
kind "StaticLib"
links { "A" }

project "C"
kind "ConsoleApp"
links { "A", "B" }
linkgroups "On"
```

This API turns this grouping on or off (it is off by default), and applies to all libraries specified in the [links](links.md) API.
### See Also ###
* [links](links.md)

0 comments on commit 8c84447

Please sign in to comment.