summaryrefslogtreecommitdiffstats
path: root/runtime/libprofile
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/libprofile')
-rw-r--r--runtime/libprofile/CommonProfiling.c17
-rw-r--r--runtime/libprofile/GCDAProfiling.c6
-rw-r--r--runtime/libprofile/Makefile4
3 files changed, 21 insertions, 6 deletions
diff --git a/runtime/libprofile/CommonProfiling.c b/runtime/libprofile/CommonProfiling.c
index 210a5e5..fbc1ef4 100644
--- a/runtime/libprofile/CommonProfiling.c
+++ b/runtime/libprofile/CommonProfiling.c
@@ -102,12 +102,19 @@ int getOutFile() {
{
int PTy = ArgumentInfo;
int Zeros = 0;
- write(OutFile, &PTy, sizeof(int));
- write(OutFile, &SavedArgsLength, sizeof(unsigned));
- write(OutFile, SavedArgs, SavedArgsLength);
+ if (write(OutFile, &PTy, sizeof(int)) < 0 ||
+ write(OutFile, &SavedArgsLength, sizeof(unsigned)) < 0 ||
+ write(OutFile, SavedArgs, SavedArgsLength) < 0 ) {
+ fprintf(stderr,"error: unable to write to output file.");
+ exit(0);
+ }
/* Pad out to a multiple of four bytes */
- if (SavedArgsLength & 3)
- write(OutFile, &Zeros, 4-(SavedArgsLength&3));
+ if (SavedArgsLength & 3) {
+ if (write(OutFile, &Zeros, 4-(SavedArgsLength&3)) < 0) {
+ fprintf(stderr,"error: unable to write to output file.");
+ exit(0);
+ }
+ }
}
}
return(OutFile);
diff --git a/runtime/libprofile/GCDAProfiling.c b/runtime/libprofile/GCDAProfiling.c
index e066b22..4ffb12b 100644
--- a/runtime/libprofile/GCDAProfiling.c
+++ b/runtime/libprofile/GCDAProfiling.c
@@ -26,7 +26,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
-#ifdef _MSC_VER
+#ifdef _WIN32
#include <direct.h>
#endif
@@ -114,7 +114,11 @@ void llvm_gcda_start_file(const char *orig_filename) {
output_file = fopen(filename, "wb");
/* gcda file, version 404*, stamp LLVM. */
+#ifdef __APPLE__
+ fwrite("adcg*204MVLL", 12, 1, output_file);
+#else
fwrite("adcg*404MVLL", 12, 1, output_file);
+#endif
#ifdef DEBUG_GCDAPROFILING
printf("llvmgcda: [%s]\n", orig_filename);
diff --git a/runtime/libprofile/Makefile b/runtime/libprofile/Makefile
index cf31e46..d851149 100644
--- a/runtime/libprofile/Makefile
+++ b/runtime/libprofile/Makefile
@@ -19,6 +19,10 @@ SHARED_LIBRARY = 1
EXTRA_DIST = libprofile.exports
EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/libprofile.exports
+# Build and install this archive.
+BUILD_ARCHIVE = 1
+override NO_INSTALL_ARCHIVES =
+
include $(LEVEL)/Makefile.common
ifeq ($(HOST_OS),Darwin)
OpenPOWER on IntegriCloud