-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt][Profile][Darwin] Fix a test that expected an alignment … #100469
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…greater than the maximum for a segment This test was failing with: -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. --
@llvm/pr-subscribers-pgo Author: Jon Roelofs (jroelofs) Changes…greater than the maximum for a segment This test was failing with:
Full diff: https://github.com/llvm/llvm-project/pull/100469.diff 1 Files Affected:
diff --git a/compiler-rt/test/profile/ContinuousSyncMode/darwin-proof-of-concept.c b/compiler-rt/test/profile/ContinuousSyncMode/darwin-proof-of-concept.c
index 85caca9a56b40..cf3bb0cd5d463 100644
--- a/compiler-rt/test/profile/ContinuousSyncMode/darwin-proof-of-concept.c
+++ b/compiler-rt/test/profile/ContinuousSyncMode/darwin-proof-of-concept.c
@@ -8,8 +8,8 @@
// Align counters and data to the maximum expected page size (16K).
// RUN: %clang -g -o %t %s \
-// RUN: -Wl,-sectalign,__DATA,__pcnts,0x4000 \
-// RUN: -Wl,-sectalign,__DATA,__pdata,0x4000
+// RUN: -Wl,-sectalign,__DATA,__pcnts,0x1000 \
+// RUN: -Wl,-sectalign,__DATA,__pdata,0x1000
// Create a 'profile' using mmap() and validate it.
// RUN: %run %t create %t.tmpfile
@@ -24,7 +24,7 @@
__attribute__((section("__DATA,__pcnts"))) int counters[] = {0xbad};
extern int cnts_start __asm("section$start$__DATA$__pcnts");
-const size_t cnts_len = 0x4000;
+const size_t cnts_len = 0x1000;
__attribute__((section("__DATA,__pdata"))) int data[] = {1, 2, 3};
extern int data_start __asm("section$start$__DATA$__pdata");
@@ -44,8 +44,8 @@ int create_tmpfile(char *path) {
return EXIT_FAILURE;
}
- // Write the data first (at offset 0x4000, after the counters).
- if (data_len != pwrite(fd, &data, data_len, 0x4000)) {
+ // Write the data first (at offset 0x1000, after the counters).
+ if (data_len != pwrite(fd, &data, data_len, cnts_len)) {
perror("write");
return EXIT_FAILURE;
}
@@ -55,7 +55,7 @@ int create_tmpfile(char *path) {
// Requirements (on Darwin):
// - &cnts_start must be page-aligned.
// - The length and offset-into-fd must be page-aligned.
- int *counter_map = (int *)mmap(&cnts_start, 0x4000, PROT_READ | PROT_WRITE,
+ int *counter_map = (int *)mmap(&cnts_start, cnts_len, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_SHARED, fd, 0);
if (counter_map != &cnts_start) {
perror("mmap");
@@ -97,7 +97,7 @@ int validate_tmpfile(char *path) {
}
// Verify that the rest of the counters (after counter 9) are 0.
- const int num_cnts = 0x4000 / sizeof(int);
+ const int num_cnts = cnts_len / sizeof(int);
for (int i = 10; i < num_cnts; ++i) {
if (buf[i] != 0) {
fprintf(stderr,
@@ -131,11 +131,11 @@ int main(int argc, char **argv) {
fprintf(stderr, "__pcnts is not page-aligned: 0x%lx.\n", cnts_start_int);
return EXIT_FAILURE;
}
- if (data_start_int % pagesz != 0) {
- fprintf(stderr, "__pdata is not page-aligned: 0x%lx.\n", data_start_int);
+ if (data_start_int % 0x1000 != 0) {
+ fprintf(stderr, "__pdata is not correctly aligned: 0x%lx.\n", data_start_int);
return EXIT_FAILURE;
}
- if (cnts_start_int + 0x4000 != data_start_int) {
+ if (cnts_start_int + 0x1000 != data_start_int) {
fprintf(stderr, "__pdata not ordered after __pcnts.\n");
return EXIT_FAILURE;
}
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
LGTM |
wrotki
approved these changes
Jul 25, 2024
jroelofs
added a commit
to swiftlang/llvm-project
that referenced
this pull request
Jul 25, 2024
llvm#100469) …greater than the maximum for a segment This test was failing with: ``` -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. -- ``` (cherry picked from commit 99bb9a7)
yuxuanchen1997
pushed a commit
that referenced
this pull request
Jul 25, 2024
#100469) Summary: …greater than the maximum for a segment This test was failing with: ``` -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. -- ``` Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250533
jroelofs
added a commit
to swiftlang/llvm-project
that referenced
this pull request
Jul 26, 2024
llvm#100469) …greater than the maximum for a segment This test was failing with: ``` -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. -- ``` (cherry picked from commit 99bb9a7)
cachemeifyoucan
pushed a commit
to cachemeifyoucan/llvm-project
that referenced
this pull request
Dec 2, 2024
llvm#100469) …greater than the maximum for a segment This test was failing with: ``` -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. -- ``` (cherry picked from commit 99bb9a7)
cachemeifyoucan
pushed a commit
to swiftlang/llvm-project
that referenced
this pull request
Dec 4, 2024
llvm#100469) …greater than the maximum for a segment This test was failing with: ``` -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. -- ``` (cherry picked from commit 99bb9a7)
cachemeifyoucan
pushed a commit
to cachemeifyoucan/llvm-project
that referenced
this pull request
Dec 6, 2024
llvm#100469) …greater than the maximum for a segment This test was failing with: ``` -- Exit Code: 1 Command Output (stderr): -- ld: warning: reducing alignment of section __DATA,__pcnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment ld: warning: reducing alignment of section __DATA,__pdata from 0x4000 to 0x1000 because it exceeds segment maximum alignment __pdata not ordered after __pcnts. -- ``` (cherry picked from commit 99bb9a7)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…greater than the maximum for a segment
This test was failing with: