<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - After e50a38840dc3, InstrProfilingPlatformLinux.c no longer compiles on FreeBSD"
   href="https://bugs.llvm.org/show_bug.cgi?id=51331">51331</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>After e50a38840dc3, InstrProfilingPlatformLinux.c no longer compiles on FreeBSD
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>profile
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After <a href="https://github.com/llvm/llvm-project/commit/e50a38840dc3">https://github.com/llvm/llvm-project/commit/e50a38840dc3</a> ("[profile] Add
binary id into profiles"), which was a re-land of
<a href="https://github.com/llvm/llvm-project/commit/f984ac2715f7">https://github.com/llvm/llvm-project/commit/f984ac2715f7</a>, building compiler-rt
on FreeBSD started failing in
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c:

compiler-rt/lib/profile/InstrProfilingPlatformLinux.c:112:56: warning: type
specifier missing, defaults to 'int' [-Wimplicit-int]
int WriteBinaryIdForNote(ProfDataWriter *Writer, const ElfW(Nhdr) * Note) {
                                                 ~~~~~ ^
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c:112:50: warning: 'const'
type qualifier on return type has no effect [-Wignored-qualifiers]
int WriteBinaryIdForNote(ProfDataWriter *Writer, const ElfW(Nhdr) * Note) {
                                                 ^~~~~~
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c:112:61: error: a
parameter list without types is only allowed in a function definition
int WriteBinaryIdForNote(ProfDataWriter *Writer, const ElfW(Nhdr) * Note) {
                                                            ^
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c:112:67: error: expected
')'
int WriteBinaryIdForNote(ProfDataWriter *Writer, const ElfW(Nhdr) * Note) {
                                                                  ^
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c:112:25: note: to match
this '('
int WriteBinaryIdForNote(ProfDataWriter *Writer, const ElfW(Nhdr) * Note) {
                        ^

This is because FreeBSD's link.h does not have the ElfW(TYPE) macro, which is
defined in Linux (actually glibc) as:

/* We use this macro to refer to ELF types independent of the native wordsize.
   `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */
#define ElfW(type)      _ElfW (Elf, __ELF_NATIVE_CLASS, type)
#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
#define _ElfW_1(e,w,t)  e##w##t

#include <bits/elfclass.h>              /* Defines __ELF_NATIVE_CLASS.  */

We probably need to define some replacement macro for FreeBSD. I'm not really
sure how the difference between 32-bit and 64-bit ELF is handled generically on
FreeBSD... :)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>