summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-11-10 04:22:48 +0000
committerBill Wendling <isanbard@gmail.com>2011-11-10 04:22:48 +0000
commit2f0727401c1b30f80f9fcb603cf388522ca8d73c (patch)
tree1c826797ea6701a7746220a39f135e053722c9f0
parent8d566cf11cc14832755d7112428b3bc6568b0c82 (diff)
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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_30@144262 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Builtins.def6
-rw-r--r--lib/Driver/ToolChains.cpp9
-rw-r--r--lib/Driver/ToolChains.h3
-rw-r--r--test/Analysis/security-syntax-checks.m2
4 files changed, 11 insertions, 9 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index e5690c1233..e06e05b1aa 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -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)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index ea604ccd07..40149269f0 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -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;
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 31c97d6e45..0e4d67c5d1 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -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);
};
diff --git a/test/Analysis/security-syntax-checks.m b/test/Analysis/security-syntax-checks.m
index 6fb5b3cf14..a04401b531 100644
--- a/test/Analysis/security-syntax-checks.m
+++ b/test/Analysis/security-syntax-checks.m
@@ -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.}}