[lld] [LLD][ELF] add bp-* options in ELF (PR #120514)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 14:32:51 PST 2024


ellishg wrote:

> @MaskRay @ellishg Hi, here is the ELF patch that adds support for the bp-* options. Could you please review it?
> 
> I also tested the ld64.lld build on my Mac locally using the --bp-compression-sort=function option to compare the effect of relocation hashes. Below are the results:
> 
> file	size	gzipped size
> lld	411,461,872	66,160,343
> lld-no-reloc	411,426,304	65,935,315
> In the lld-no-reloc version, I removed the following code responsible for calculating relocation hashes:
> 
> https://github.com/llvm/llvm-project/blob/1cc926b8b6976ac4a5a411eae564cfde2df1ef9d/lld/MachO/BPSectionOrderer.h#L104-L115
> 
> The results show that removing relocation hashes reduces the file size and gzip-compressed size slightly. I’m concerned that something might be wrong here—do you have any insights or thoughts on this?

Hmm I'm not sure why hashing relocations is not as effective on ELF. We know this is effective on our use cases on Mach-O and I think @dreampiggy measured some wins on Mach-O in [this comment](https://github.com/llvm/llvm-project/pull/96268#discussion_r1858053118). It might depend on some features of the binary you are building.

https://github.com/llvm/llvm-project/pull/120514


More information about the llvm-commits mailing list