Author: Rainer Orth Date: 2021-08-18T12:54:30-07:00 New Revision: 98feb20df14e6cf9ce77f097ceb8dd188c9070a7
URL: https://github.com/llvm/llvm-project/commit/98feb20df14e6cf9ce77f097ceb8dd188c9070a7 DIFF: https://github.com/llvm/llvm-project/commit/98feb20df14e6cf9ce77f097ceb8dd188c9070a7.diff LOG: [profile] Only use NT_GNU_BUILD_ID if supported The Solaris buildbots have been broken for some time by the unconditional use of `NT_GNU_BUILD_ID`, e.g. Solaris/sparcv9 <https://lab.llvm.org/staging/#/builders/50/builds/4910> and Solaris/amd64 <https://lab.llvm.org/staging/#/builders/101/builds/3751>. Being a GNU extension, it is not defined in `<sys/elf.h>`. However, providing a fallback definition doesn't help because the code also relies on `__ehdr_start`, another unportable GNU extension that most likely never will be implemented in Solaris `ld`. Besides, there's reallly no point in supporting build ids since they aren't used on Solaris at all. This patch fixes this by making the relevant code conditional on the definition of `NT_GNU_BUILD_ID`. Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`. Differential Revision: https://reviews.llvm.org/D107556 (cherry picked from commit 779714f89bef33f153841b7ec969578ee22b3694) Added: Modified: compiler-rt/lib/profile/InstrProfilingPlatformLinux.c Removed: ################################################################################ diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c index d1922e27ae1d0..7c15f97aff898 100644 --- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c +++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c @@ -85,6 +85,7 @@ COMPILER_RT_VISIBILITY ValueProfNode *__llvm_profile_end_vnodes(void) { COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = &PROF_VNODES_START; COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = &PROF_VNODES_STOP; +#ifdef NT_GNU_BUILD_ID static size_t RoundUp(size_t size, size_t align) { return (size + align - 1) & ~(align - 1); } @@ -188,5 +189,14 @@ COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) { return 0; } +#else /* !NT_GNU_BUILD_ID */ +/* + * Fallback implementation for targets that don't support the GNU + * extensions NT_GNU_BUILD_ID and __ehdr_start. + */ +COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) { + return 0; +} +#endif #endif _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits