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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 23:22:02 PST 2025


================
@@ -0,0 +1,325 @@
+# REQUIRES: aarch64
+
+# RUN: rm -rf %t && split-file %s %t && cd %t
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64 a.s -o a.o
+# RUN: llvm-profdata merge a.proftext -o a.profdata
+# RUN: ld.lld -e main -o a.out a.o --irpgo-profile=a.profdata --bp-startup-sort=function --verbose-bp-section-orderer --icf=all 2>&1 | FileCheck %s --check-prefix=STARTUP
+
+# STARTUP: Ordered 3 sections using balanced partitioning
+
+# RUN: ld.lld -e main -o - a.o --symbol-ordering-file a.orderfile --irpgo-profile=a.profdata --bp-startup-sort=function | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE
----------------
MaskRay wrote:

`_main` is Mach-O's entry. For ELF just use `_start` as the entry and remove `-e main`

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


More information about the llvm-commits mailing list