[lld] [lld][ELF] Extend profile guided function ordering to ELF binaries (PR #117514)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 22:32:48 PST 2024
================
@@ -0,0 +1,868 @@
+# 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
+
+.ifdef GEN
+#--- a.cc
+const char s1[] = "hello world";
+const char s2[] = "i am a string";
+const char* r1 = s1;
+const char** r2 = &r1;
+void A() {
+ return;
+}
+
+int B(int a) {
+ A();
+ return a + 1;
+}
+
+int C(int a) {
+ A();
+ return a + 2;
+}
+
+int D(int a) {
+ return B(a + 2);
+}
+
+int E(int a) {
+ return C(a + 2);
+}
+
+int F(int a) {
+ return C(a + 3);
+}
+
+int main() {
+ return 0;
+}
+#--- gen
+echo '#--- a.s'
+clang -target aarch64-linux-gnu -fdebug-compilation-dir='/proc/self/cwd' -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-asynchronous-unwind-tables -S -g a.cc -o -
----------------
MaskRay wrote:
Prefer `--target=` to `-target ` (deprecated since around Clang 3.4)
https://github.com/llvm/llvm-project/pull/117514
More information about the llvm-commits
mailing list