// Test __llvm_profile_get_filename when the on-line merging mode is enabled.
//
// RUN: %clang_pgogen -dynamiclib -o %t.dso %p/Inputs/instrprof-get-filename-dso.c
// RUN: %clang_pgogen -o %t %s %t.dso
// RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t

#include <string.h>

const char *__llvm_profile_get_filename(void);
extern const char *get_filename_from_DSO(void);

int main(int argc, const char *argv[]) {
  const char *filename1 = __llvm_profile_get_filename();
  const char *filename2 = get_filename_from_DSO();

  // Exit with code 1 if the two filenames are the same.
  return strcmp(filename1, filename2) == 0;
}

// Test __llvm_profile_get_filename when the on-line merging mode is enabled.
//
// RUN: %clang_pgogen -fPIC -shared -o %t.dso %p/../Inputs/instrprof-get-filename-dso.c
// RUN: %clang_pgogen -o %t %s %t.dso
// RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t

#include <string.h>

const char *__llvm_profile_get_filename(void);
extern const char *get_filename_from_DSO(void);

int main(int argc, const char *argv[]) {
  const char *filename1 = __llvm_profile_get_filename();
  const char *filename2 = get_filename_from_DSO();

  // Exit with code 1 if the two filenames are the same.
  return strcmp(filename1, filename2) == 0;
}

Use -fPIC -shared in a test instead of -dynamiclib
[profile] Use -fPIC -shared in a test instead of -dynamiclib

This is more portable than -dynamiclib. Also, fix the path to an input
file that broke when the test was moved in r375315.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@375317 91177308-0d34-0410-b5e6-96231b3b80d8
