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

    <tr>
        <th>Summary</th>
        <td>
            [PowerPC] Sanitizers fail to build on FreeBSD
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    After enabling sanitizers on FreeBSD/powerpc64(le), build fails with:
```
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2084:31: error: no member named 'regs' in '__mcontext'                                                                   *pc = ucontext->uc_mcontext.regs->nip;                                                                                                                                                                                                            ~~~~~~~~~~~~~~~~~~~~~ ^                                                                                                                                                                                                             /wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2085:31: error: no member named 'regs' in '__mcontext'                                                                   *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];                                                                                                                                                                                             
        ~~~~~~~~~~~~~~~~~~~~~ ^                                                                                                                                                                                                             
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2085:41: error: use of undeclared identifier 'PT_R1'                                                                   
  *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];                                                                                                                                                                                             
                                        ^                                                                                                                                                                                                   
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2088:31: error: no member named 'regs' in '__mcontext'                                                                 
  *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];                                                                                                                                                                                            
        ~~~~~~~~~~~~~~~~~~~~~ ^                                                                                                                                                                                                             
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2088:41: error: use of undeclared identifier 'PT_R31'                                                                  
  *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];                                                                                                                                                                                            
                                        ^                                                                                                                                                                                                   
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2179:25: error: use of undeclared identifier 'personality'                                                          
  int old_personality = personality(0xffffffff);
                        ^
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2180:51: error: use of undeclared identifier 'ADDR_NO_RANDOMIZE'
  if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
                                                  ^
/wrkdirs/usr/ports/devel/llvm14/work/llvm-project-14.0.0rc1.src/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2185:44: error: use of undeclared identifier 'ADDR_NO_RANDOMIZE'
    CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
                                           ^
8 errors generated.
```

The problem is that sanitizer_linux.cpp lacks support for FreeBSD on POWER.
https://reviews.llvm.org/D116867 fixes the build issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWNtu2zgQ_RrqhbAg6q4HPTi2g10UTYK0QIG-GJQ0stlQokBSSdqvL6koTt0aabIxUG3hAcGbKM7wcI7GnkJUX_N5rUFiaGnBWbvBirZMs28gFRYtPpcAZx-WyD_vxB3IroxD5KcckJ8hf4GLnvEK15Rxhe-Y3qJgjrwl8uYo9sbyMPTP7-RNxaQyvV7JYT-p7aiCW-Cm5fy2IaFdKOTNOJ51UnyBUs9I6HquJ0viKlmah6VoOsZBzqS2S1lh6p3ha_O0Ee3elDlaf--WXWcs9L00NE1ATIVBSiFtpxW4gaYwULS0gQojP5GwMRYmmLV2tF43pWg13Gs793ZB_rwrMQqWuB_3naFg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