[PATCH] D40944: [profile] Enable on Solaris
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 04:58:19 PST 2017
ro updated this revision to Diff 126534.
ro marked an inline comment as done.
ro added a comment.
I've moved the InstrProfiling*.h after the system headers now (without a comment
yet because it's unclear where best to put it), but there are reasons to also include them
early:
COMPILER_RT_HAS_UNAME was defined in InstrProfilingPort.h and used to control
whether or not to include <sys/utsname.h>. When InstrProfilingPort.h is included later,
this won't work, so I moved the check for <sys/utsname.h> to CMakeLists.txt.
Initially, this didn't work as expected: I tried check_include_file. Although checking for
a header could be a compile-only test, that function tries to link, which fails since
cmake/config-ix.cmake adds -nodefaultlibs to CMAKE_REQUIRED_FLAGS, so both
the startup files and libc are missing and the link fails.
Besides, I now print getpid() as long (which it can be on Solaris), avoiding a warning.
uname(2) is documented in POSIX.1-2008 to be non-negative on success (and
Solaris returns 1), while InstrProfilingUtil.c (lprofGetHostName) only expects the
0 return value found on Linux.
Last but not least, I found that I'd overlooked to enable the profile tests. With
a version of Solaris ld that supports the non-standard GNU ld extension of adding
__start_SECNAME and __stop_SECNAME labels to sections whose names are valid
as C identifiers and an LLVM companion patch to enable that (https://reviews.llvm.org/D41111),
all tests pass.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D40944
Files:
cmake/config-ix.cmake
lib/profile/CMakeLists.txt
lib/profile/GCDAProfiling.c
lib/profile/InstrProfiling.c
lib/profile/InstrProfilingFile.c
lib/profile/InstrProfilingInternal.h
lib/profile/InstrProfilingPlatformLinux.c
lib/profile/InstrProfilingPlatformOther.c
lib/profile/InstrProfilingPort.h
lib/profile/InstrProfilingUtil.c
lib/profile/InstrProfilingUtil.h
lib/profile/InstrProfilingValue.c
lib/profile/InstrProfilingWriter.c
lib/profile/WindowsMMap.c
test/profile/lit.cfg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40944.126534.patch
Type: text/x-patch
Size: 12815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/93f32d4b/attachment.bin>
More information about the llvm-commits
mailing list