https://bugs.llvm.org/show_bug.cgi?id=51331

            Bug ID: 51331
           Summary: After e50a38840dc3, InstrProfilingPlatformLinux.c no
                    longer compiles on FreeBSD
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: profile
          Assignee: unassignedb...@nondot.org
          Reporter: dimi...@andric.com
                CC: llvm-bugs@lists.llvm.org

After https://github.com/llvm/llvm-project/commit/e50a38840dc3 ("[profile] Add
binary id into profiles"), which was a re-land of
https://github.com/llvm/llvm-project/commit/f984ac2715f7, 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... :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to