Skip to content

[compiler-rt][Darwin][x86] Fix instrprof-darwin-dead-strip test #132874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

dtellenbach
Copy link
Member

ld issues a warning about section alignment on x86. Explicitly setting the alignment fixes that.

ld issues a warning about section alignment on x86. Explicitly setting
the alignment fixes that.
@llvmbot llvmbot added compiler-rt PGO Profile Guided Optimizations labels Mar 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 25, 2025

@llvm/pr-subscribers-pgo

Author: David Tellenbach (dtellenbach)

Changes

ld issues a warning about section alignment on x86. Explicitly setting the alignment fixes that.


Full diff: https://github.com/llvm/llvm-project/pull/132874.diff

1 Files Affected:

  • (modified) compiler-rt/test/profile/instrprof-darwin-dead-strip.c (+6-3)
diff --git a/compiler-rt/test/profile/instrprof-darwin-dead-strip.c b/compiler-rt/test/profile/instrprof-darwin-dead-strip.c
index 79182938b10aa..7f3b48ba74808 100644
--- a/compiler-rt/test/profile/instrprof-darwin-dead-strip.c
+++ b/compiler-rt/test/profile/instrprof-darwin-dead-strip.c
@@ -1,7 +1,8 @@
 // REQUIRES: osx-ld64-live_support
 // REQUIRES: lto
 
-// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -o %t %s
+// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip \
+// RUN:   -Wl,-sectalign,__DATA,__llvm_prf_cnts,0x1000 -Wl,-sectalign,__DATA,__llvm_prf_data,0x1000 -Wl,-sectalign,__DATA,__llvm_prf_bits,0x1000 -o %t %s
 // RUN: %run %t
 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
 // RUN: llvm-profdata show --all-functions %t.profdata | FileCheck %s -check-prefix=PROF
@@ -10,7 +11,8 @@
 // RUN: otool -V -s __DATA __llvm_prf_names %t | FileCheck %s -check-prefix=PRF_NAMES
 // RUN: otool -V -s __DATA __llvm_prf_cnts %t | FileCheck %s -check-prefix=PRF_CNTS
 
-// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -flto -o %t.lto %s
+// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -Wl,-w -flto \
+// RUN:   -Wl,-sectalign,__DATA,__llvm_prf_cnts,0x1000 -Wl,-sectalign,__DATA,__llvm_prf_data,0x1000 -Wl,-sectalign,__DATA,__llvm_prf_bits,0x1000 -o %t.lto %s
 // RUN: %run %t.lto
 // RUN: llvm-profdata merge -o %t.lto.profdata %t.lto.profraw
 // RUN: llvm-profdata show --all-functions %t.lto.profdata | FileCheck %s -check-prefix=PROF
@@ -25,7 +27,8 @@
 // Note: When there is no code in a program, we expect to see the exact same
 // set of external functions provided by the profile runtime.
 
-// RUN: %clang_profgen -fcoverage-mapping -Wl,-dead_strip -dynamiclib -o %t.nocode.dylib %s
+// RUN: %clang_profgen -fcoverage-mapping -Wl,-dead_strip -Wl,-sectalign,__DATA,__llvm_prf_cnts,0x1000 \
+// RUN:   -Wl,-sectalign,__DATA,__llvm_prf_data,0x1000 -Wl,-sectalign,__DATA,__llvm_prf_bits,0x1000 -dynamiclib -o %t.nocode.dylib %s
 // RUN: nm -jgU %t.nocode.dylib > %t.nocode.syms
 // RUN: nm -jgU %t | sed -e '/_\{1,\}main/d' -e '/_\{1,\}mh_execute_header/d' > %t.code.syms
 // RUN: diff %t.nocode.syms %t.code.syms

@dtellenbach dtellenbach merged commit 03eb825 into llvm:main Mar 26, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants