Timmmm
Timmmm

Reputation: 96605

Disable relocations when linking with LLD

Is there an option for lld that will tell it not to perform relocations. I don't want PIC code, I just want relocations not to be performed. (Yes I know this will result in an executable that doesn't work.)

Upvotes: 3

Views: 1747

Answers (1)

Timmmm
Timmmm

Reputation: 96605

Turns out to be an easy and fairly obvious solution - just pass -r or --relocatable. Then it won't apply relocations but will store them in the output file instead.

Edit: Unfortunately this does not quite have the effect I want, because you can't use --gc-sections and --relocatable at the same time.

Upvotes: 2

Related Questions