<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/88053>88053</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            macos profile runtime test failures due to new ld warning on overaligned sections
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aeubanks
      </td>
    </tr>
</table>

<pre>
    With a new Apple `ld`, we're seeing these two tests fail on both x86-64 and arm64:

```
 Failed Tests (2):
 Profile-x86_64 :: ContinuousSyncMode/darwin-proof-of-concept.c
 Profile-x86_64 :: instrprof-darwin-exports.c
```

e.g.

```
 FAIL: Profile-x86_64 :: ContinuousSyncMode/darwin-proof-of-concept.c (71302 of 74416)
 ******************** TEST 'Profile-x86_64 :: ContinuousSyncMode/darwin-proof-of-concept.c' FAILED ********************
 Exit Code: 1
 
 Command Output (stderr):
 --
 RUN: at line 10: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/./bin/clang -arch x86_64  -mmacosx-version-min=10.13 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -mlinker-version=1053.12  -g -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-x86_64/ContinuousSyncMode/Output/darwin-proof-of-concept.c.tmp /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/profile/ContinuousSyncMode/darwin-proof-of-concept.c -Wl,-sectalign,__DATA,__pcnts,0x4000 -Wl,-sectalign,__DATA,__pdata,0x4000
 + /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/./bin/clang -arch x86_64 -mmacosx-version-min=10.13 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -mlinker-version=1053.12 -g -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-x86_64/ContinuousSyncMode/Output/darwin-proof-of-concept.c.tmp /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/profile/ContinuousSyncMode/darwin-proof-of-concept.c -Wl,-sectalign,__DATA,__pcnts,0x4000 -Wl,-sectalign,__DATA,__pdata,0x4000
 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
 RUN: at line 15: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-x86_64/ContinuousSyncMode/Output/darwin-proof-of-concept.c.tmp create /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-x86_64/ContinuousSyncMode/Output/darwin-proof-of-concept.c.tmp.tmpfile
 + /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-x86_64/ContinuousSyncMode/Output/darwin-proof-of-concept.c.tmp create /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-bootstrap/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-x86_64/ContinuousSyncMode/Output/darwin-proof-of-concept.c.tmp.tmpfile
 __pdata not ordered after __pcnts.
 
 --

 FAIL: Profile-x86_64 :: instrprof-darwin-exports.c (71383 of 74416)
 ******************** TEST 'Profile-x86_64 :: instrprof-darwin-exports.c' FAILED ********************
 Exit Code: 1
 
 Command Output (stdout):
 --
 ld: warning: reducing alignment of section __DATA,__llvm_prf_cnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment
 ld: warning: reducing alignment of section __DATA,__llvm_prf_data from 0x4000 to 0x1000 because it exceeds segment maximum alignment
 ld: warning: reducing alignment of section __DATA,__llvm_prf_bits from 0x4000 to 0x1000 because it exceeds segment maximum alignment
 ld: warning: reducing alignment of section __DATA,__llvm_prf_cnts from 0x4000 to 0x1000 because it exceeds segment maximum alignment
 ld: warning: reducing alignment of section __DATA,__llvm_prf_data from 0x4000 to 0x1000 because it exceeds segment maximum alignment
 ld: warning: reducing alignment of section __DATA,__llvm_prf_bits from 0x4000 to 0x1000 because it exceeds segment maximum alignment
 
 --
```

I believe both these test failures are due to some page size/alignment changes.

clang tells ld to set alignment [here](https://github.com/llvm/llvm-project/blob/50a6738636d1b1dda0c5887cf0623ee084854272/clang/lib/Driver/ToolChains/Darwin.cpp#L1397)

@vedantk 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWFtv2zYU_jX0y4EEirrmwQ-uXQPF2rVYsrVvASUe2VwoUiAp29mvHyjLyZJ16S1tg66ALVES-fE7F57DQ-6c3GjEOcmfkXw144PfGjvnONRcX7lZbcT1_K30W-CgcQ-LvlcIpKBKkIIStoQ9ElZaBIco9Qb8Fh2C3xvw6LyDlksFRkNt_BYOVREVGXAtgNuuyEi6IHRF6Ola0Ok3PsKaS4UCLkYgwipG2NnNEHhjTSsVRoequCwyCB_SBSyN9lIPZnDn17p5ZQQSthbc7qWOemtMG5k2aoxusPdx8yCU1M7b3po2msbjoTfWu9Owe3SPV4w38YMyLV68DOCPwT7opExSysC0UGZZUgQFHechbPHZP7h4fn4BhJWPomJWjkI_X30Rp0ms5wfpYRmmTBeQnGQ93pam64JrvR58P_igHOcFWnvHa6Joavz2-68Bg3tQUiMkNDwRtv7DqKFDR9j6rbFXhK1Dc0_YWlrC1g1vtkHcepBKYHjjbEPY2m-lFZc9t_6asLVSuy6qjfHOW94Tto7DEKkDgOJ6AxG3zbgcgloh6jreGHeIdmidNDrqpCbpKqFxkkIk3bWzxviPJ2fc4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