Commit 1b871840 authored by Bill Wendling's avatar Bill Wendling
Browse files

Merging r142531:

------------------------------------------------------------------------
r142531 | rafael | 2011-10-19 07:50:34 -0700 (Wed, 19 Oct 2011) | 3 lines

Fix the signatures of vfork, __sigsetjmp and sigsetjmp.

Patch by Dimitry Andric.
------------------------------------------------------------------------

llvm-svn: 144262
parent a7d131fb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -672,16 +672,16 @@ LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_LANGUAGES)
LIBBUILTIN(bzero, "vv*z",         "f",     "strings.h", ALL_LANGUAGES)
// POSIX unistd.h
LIBBUILTIN(_exit, "vi",           "fr",    "unistd.h", ALL_LANGUAGES)
LIBBUILTIN(vfork, "iJ",           "fj",    "unistd.h", ALL_LANGUAGES)
LIBBUILTIN(vfork, "i",            "fj",    "unistd.h", ALL_LANGUAGES)
// POSIX setjmp.h

// In some systems setjmp is a macro that expands to _setjmp. We undefine
// it here to avoid having two identical LIBBUILTIN entries.
#undef setjmp
LIBBUILTIN(_setjmp, "iJ",         "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iJ",     "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iJi",    "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp, "iJ",          "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iJ",       "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iJi",      "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp_syscall, "iJ",  "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(savectx, "iJ",         "fj",   "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(qsetjmp, "iJ",         "fj",   "setjmp.h", ALL_LANGUAGES)
+5 −4
Original line number Diff line number Diff line
@@ -1629,7 +1629,7 @@ Linux::GCCInstallationDetector::GCCInstallationDetector(const Driver &D)
      if (!llvm::sys::fs::exists(LibDir))
        continue;
      for (unsigned k = 0, ke = CandidateTriples.size(); k < ke; ++k)
        ScanLibDirForGCCTriple(LibDir, CandidateTriples[k]);
        ScanLibDirForGCCTriple(HostArch, LibDir, CandidateTriples[k]);
    }
  }
}
@@ -1695,7 +1695,8 @@ Linux::GCCInstallationDetector::GCCInstallationDetector(const Driver &D)
}

void Linux::GCCInstallationDetector::ScanLibDirForGCCTriple(
    const std::string &LibDir, StringRef CandidateTriple) {
    llvm::Triple::ArchType HostArch, const std::string &LibDir,
    StringRef CandidateTriple) {
  // There are various different suffixes involving the triple we
  // check for. We also record what is necessary to walk from each back
  // up to the lib directory.
@@ -1707,7 +1708,7 @@ void Linux::GCCInstallationDetector::ScanLibDirForGCCTriple(
    // match.
    // FIXME: It may be worthwhile to generalize this and look for a second
    // triple.
    "/" + CandidateTriple.str() + "/gcc/i686-linux-gnu"
    "/i386-linux-gnu/gcc/" + CandidateTriple.str()
  };
  const std::string InstallSuffixes[] = {
    "/../../..",
@@ -1716,7 +1717,7 @@ void Linux::GCCInstallationDetector::ScanLibDirForGCCTriple(
  };
  // Only look at the final, weird Ubuntu suffix for i386-linux-gnu.
  const unsigned NumSuffixes = (llvm::array_lengthof(Suffixes) -
                                (CandidateTriple != "i386-linux-gnu"));
                                (HostArch != llvm::Triple::x86));
  for (unsigned i = 0; i < NumSuffixes; ++i) {
    StringRef Suffix = Suffixes[i];
    llvm::error_code EC;
+2 −1
Original line number Diff line number Diff line
@@ -445,7 +445,8 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
                                         SmallVectorImpl<StringRef> &LibDirs,
                                         SmallVectorImpl<StringRef> &Triples);

    void ScanLibDirForGCCTriple(const std::string &LibDir,
    void ScanLibDirForGCCTriple(llvm::Triple::ArchType HostArch,
                                const std::string &LibDir,
                                StringRef CandidateTriple);
  };

+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ void test_strcat() {
//===----------------------------------------------------------------------===
typedef int __int32_t;
typedef __int32_t pid_t;
pid_t vfork(void); //expected-warning{{declaration of built-in function 'vfork' requires inclusion of the header <setjmp.h>}}
pid_t vfork(void);

void test_vfork() {
  vfork(); //expected-warning{{Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process.}}