summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/asan/scripts')
-rwxr-xr-xcompiler-rt/lib/asan/scripts/gen_asm_instrumentation.sh215
1 files changed, 0 insertions, 215 deletions
diff --git a/compiler-rt/lib/asan/scripts/gen_asm_instrumentation.sh b/compiler-rt/lib/asan/scripts/gen_asm_instrumentation.sh
deleted file mode 100755
index e423a53d81e..00000000000
--- a/compiler-rt/lib/asan/scripts/gen_asm_instrumentation.sh
+++ /dev/null
@@ -1,215 +0,0 @@
-#!/bin/bash
-
-#===- lib/asan/scripts/gen_asm_instrumentation.sh -------------------------===#
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-# Emit x86 instrumentation functions for asan.
-#
-#===-----------------------------------------------------------------------===#
-
-
-check() {
- test $# -eq 2 || (echo "Incorrent number of arguments: $#" 1>&2 && exit 1)
- case "$1" in
- store) ;;
- load) ;;
- *) echo "Incorrect first argument: $1" 1>&2 && exit 1 ;;
- esac
- case "$2" in
- [0-9]*) ;;
- *) echo "Incorrect second argument: $2" 1>&2 && exit 1 ;;
- esac
-}
-
-fname() {
- check $1 $2
- echo "__sanitizer_sanitize_$1$2"
-}
-
-flabel() {
- check $1 $2
- echo ".sanitize_$1$2_done"
-}
-
-freport() {
- check $1 $2
- echo "__asan_report_$1$2"
-}
-
-cat <<EOF
-// This file was generated by $(basename $0). Please, do not edit
-// manually.
-EOF
-
-echo ".section .text"
-
-echo "#if defined(__i386__)"
-
-# Functions for i386 1-, 2- and 4-byte accesses.
-for as in 1 2 4
-do
- for at in store load
- do
-cat <<EOF
-.globl $(fname $at $as)
-$(fname $at $as):
- pushl %ebp
- movl %esp, %ebp
- pushl %eax
- pushl %ecx
- pushl %edx
- pushfl
- movl 8(%ebp), %eax
- movl %eax, %ecx
- shrl \$0x3, %ecx
- movb 0x20000000(%ecx), %cl
- testb %cl, %cl
- je $(flabel $at $as)
- movl %eax, %edx
- andl \$0x7, %edx
-EOF
-
- case $as in
- 1) ;;
- 2) echo ' incl %edx' ;;
- 4) echo ' addl $0x3, %edx' ;;
- *) echo "Incorrect access size: $as" 1>&2; exit 1 ;;
- esac
-
-cat <<EOF
- movsbl %cl, %ecx
- cmpl %ecx, %edx
- jl $(flabel $at $as)
- pushl %eax
- call $(freport $at $as)
-$(flabel $at $as):
- popfl
- popl %edx
- popl %ecx
- popl %eax
- movl %ebp, %esp
- popl %ebp
- ret
-EOF
- done
-done
-
-# Functions for i386 8- and 16-byte accesses.
-for as in 8 16
-do
- for at in store load
- do
-cat <<EOF
-.globl $(fname $at $as)
-$(fname $at $as):
- pushl %ebp
- movl %esp, %ebp
- pushl %eax
- pushl %ecx
- pushfl
- movl 8(%ebp), %eax
- movl %eax, %ecx
- shrl \$0x3, %ecx
-EOF
-
- case ${as} in
- 8) echo ' cmpb $0x0, 0x20000000(%ecx)' ;;
- 16) echo ' cmpw $0x0, 0x20000000(%ecx)' ;;
- *) echo "Incorrect access size: ${as}" 1>&2; exit 1 ;;
- esac
-
-cat <<EOF
- je $(flabel $at $as)
- pushl %eax
- call $(freport $at $as)
-$(flabel $at $as):
- popfl
- popl %ecx
- popl %eax
- movl %ebp, %esp
- popl %ebp
- ret
-EOF
- done
-done
-
-echo "#endif // defined(__i386__)"
-
-echo "#if defined(__x86_64__)"
-
-# Functions for x86-64 1-, 2- and 4-byte accesses.
-for as in 1 2 4
-do
- for at in store load
- do
-cat <<EOF
-.globl $(fname $at $as)
-$(fname $at $as):
- pushq %rax
- pushq %rcx
- pushfq
- movq %rdi, %rax
- shrq \$0x3, %rax
- movb 0x7fff8000(%rax), %al
- test %al, %al
- je $(flabel $at $as)
- movl %edi, %ecx
- andl \$0x7, %ecx
-EOF
-
- case ${as} in
- 1) ;;
- 2) echo ' incl %ecx' ;;
- 4) echo ' addl $0x3, %ecx' ;;
- *) echo "Incorrect access size: ${as}" 1>&2; exit 1 ;;
- esac
-
-cat <<EOF
- movsbl %al, %eax
- cmpl %eax, %ecx
- jl $(flabel $at $as)
- call $(freport $at $as)
-$(flabel $at $as):
- popfq
- popq %rcx
- popq %rax
- ret
-EOF
- done
-done
-
-# Functions for x86-64 8- and 16-byte accesses.
-for as in 8 16
-do
- for at in store load
- do
-cat <<EOF
-.globl $(fname $at $as)
-$(fname $at $as):
- pushq %rax
- pushfq
- movq %rdi, %rax
- shrq \$0x3, %rax
-EOF
-
- case ${as} in
- 8) echo ' cmpb $0x0, 0x7fff8000(%rax)' ;;
- 16) echo ' cmpw $0x0, 0x7fff8000(%rax)' ;;
- *) echo "Incorrect access size: ${as}" 1>&2; exit 1 ;;
- esac
-
-cat <<EOF
- je $(flabel $at $as)
- call $(freport $at $as)
-$(flabel $at $as):
- popfq
- popq %rax
- ret
-EOF
- done
-done
-echo "#endif // defined(__x86_64__)"
OpenPOWER on IntegriCloud