summaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorkcc <kcc@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-23 04:09:17 +0000
committerkcc <kcc@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-23 04:09:17 +0000
commit36a69f1972558e81d0f685a4199aec142ee7bec2 (patch)
tree02c7148c9f6a8608bf6dd07d39920960e7bd38ff /libsanitizer
parentfc8a0f6057d7d0f4079bc7249825002f58da6613 (diff)
downloadgcc-36a69f1972558e81d0f685a4199aec142ee7bec2.tar.gz
[libsanitizer] a script to help merging asan/tsan from upstream
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193743 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog4
-rw-r--r--libsanitizer/README.gcc3
-rwxr-xr-xlibsanitizer/merge.sh79
3 files changed, 86 insertions, 0 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index ce59f906aaf..7e206f9b96c 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,7 @@
+2012-11-23 Kostya Serebryany <kcc@google.com>
+
+ * merge.sh: a script that will help merges from upstream.
+
2012-11-23 Jakub Jelinek <jakub@redhat.com>
* tsan/Makefile.am (AM_CXXFLAGS): Remove -Wno-variadic-macros.
diff --git a/libsanitizer/README.gcc b/libsanitizer/README.gcc
index 8fb0a932b40..92759df2eb9 100644
--- a/libsanitizer/README.gcc
+++ b/libsanitizer/README.gcc
@@ -13,3 +13,6 @@ http://llvm.org/svn/llvm-project/compiler-rt in the following directories:
Trivial and urgent fixes (portability, build fixes, etc.) may go directly to the
GCC tree. All non-trivial changes, functionality improvements, etc. should go
through the upstream tree first and then be merged back to the GCC tree.
+The merges from upstream should be done with the aid of the merge.sh script;
+it will also update the file MERGE to contain the upstream revision
+we merged with.
diff --git a/libsanitizer/merge.sh b/libsanitizer/merge.sh
new file mode 100755
index 00000000000..6918ee2475f
--- /dev/null
+++ b/libsanitizer/merge.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+# FIXME: do we need a license (or whatever else) header here?
+
+# This script merges libsanitizer sources from upstream.
+
+get_upstream() {
+ rm -rf upstream
+ #cp -rf orig upstream
+ svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk upstream
+}
+
+get_current_rev() {
+ cd upstream
+ svn info | grep Revision | grep -o '[0-9]*'
+}
+
+list_files() {
+ (cd $1; ls *.{cc,h} 2> /dev/null)
+
+}
+
+change_comment_headers() {
+ for f in $(list_files $1); do
+ changed=$(awk 'NR != 2 && NR != 3' < $1/$f)
+ echo "$changed" > $1/$f
+ done
+}
+
+# ARGUMENTS: upstream_path local_path
+# This function merges changes from the directory upstream_path to
+# the directory local_path.
+merge() {
+ upstream_path=upstream/$1
+ local_path=$2
+ change_comment_headers $upstream_path
+ echo MERGE: $upstream_path
+ all=$( (list_files $upstream_path; list_files $local_path) | sort | uniq)
+ #echo $all
+ for f in $all; do
+ if [ -f $upstream_path/$f -a -f $local_path/$f ]; then
+ echo "FOUND IN BOTH :" $f
+ # diff -u $local_path/$f $upstream_path/$f
+ cp -v $upstream_path/$f $local_path
+ elif [ -f $upstream_path/$f ]; then
+ echo "FOUND IN UPSTREAM :" $f
+ echo "UNSUPPORTED YET" && exit 1
+ elif [ -f $local_path/$f ]; then
+ echo "FOUND IN LOCAL :" $f
+ echo "UNSUPPORTED YET" && exit 1
+ fi
+ done
+
+}
+
+fatal() {
+ echo "$1"
+ exit 1;
+}
+
+pwd | grep 'libsanitizer$' || \
+ fatal "Run this script from libsanitizer dir"
+get_upstream
+CUR_REV=$(get_current_rev)
+echo Current upstream revision: $CUR_REV
+merge include/sanitizer include/sanitizer
+merge lib/asan asan
+merge lib/sanitizer_common sanitizer_common
+merge lib/interception interception
+
+rm -rf upstream
+
+# Update the MERGE file.
+cat << EOF > MERGE
+$CUR_REV
+
+The first line of this file holds the svn revision number of the
+last merge done from the master library sources.
+EOF