Skip to content

Add optional LDFLAGS to Makefile in order to support faster linking #1127

@uweseimet

Description

@uweseimet

Using the "mold", "gold" or "lld" linker instead of the regular bfd linker significantly shortens linking the final binaries and uses less memory.
On my Linux PC with mold piscsi takes about 0.2 s for linking, whereas with bfd it needs about 4.5 s.
On a Pi Zero with lld (mold would be faster but does not appear to be available for Raspbian) linking piscsi takes about 25 s, with gold about 50 s, with bfd about 2.5 min. All in all on a slow Pi several minutes of build time can be saved.

By adding optional LDFLAGS to the Makefile the linker to be used is selectable, e.g.

export LDFLAGS="-fuse-ld=gold"

This change is backwards compatible.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions