diff --git a/.gitattributes b/.gitattributes index 4daad91a14858c15c06737cb427e92cd15276ed3..2770518a5419ee17843d29bdb96361131c6c3ee0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,22 +1,23 @@ * text=auto !eol /Makefile -text -cgc_callbacks/Makefile.in -text -cgc_callbacks/configure -text -cgc_callbacks/configure.in -text -cgc_callbacks/example/Makefile.in -text -cgc_callbacks/example/callback.c -text -cgc_callbacks/lib/Makefile.in -text -cgc_callbacks/lib/crt.s -text -cgc_callbacks/libc/Makefile.in -text -cgc_callbacks/libc/include/cgc.h -text -cgc_callbacks/libc/include/malloc.h -text -cgc_callbacks/libc/include/stdint.h -text -cgc_callbacks/libc/include/stdlib.h -text -cgc_callbacks/libc/include/unistd.h -text -cgc_callbacks/libc/src/Makefile.in -text -cgc_callbacks/libc/src/cgc.s -text -cgc_callbacks/libc/src/malloc.c -text -cgc_callbacks/libc/src/unistd.c -text +callbacks/Makefile.in -text +callbacks/configure -text +callbacks/configure.in -text +callbacks/example/Makefile.in -text +callbacks/example/callback.c -text +callbacks/lib/Makefile.in -text +callbacks/lib/crt.s -text +callbacks/libc/Makefile.in -text +callbacks/libc/include/cgc.h -text +callbacks/libc/include/malloc.h -text +callbacks/libc/include/stdint.h -text +callbacks/libc/include/stdlib.h -text +callbacks/libc/include/syscall.h -text +callbacks/libc/include/unistd.h -text +callbacks/libc/src/Makefile.in -text +callbacks/libc/src/cgc.s -text +callbacks/libc/src/malloc.c -text +callbacks/libc/src/unistd.c -text include/range.h -text include/unresolved.h -text include/zipr.h -text diff --git a/cgc_callbacks/Makefile.in b/callbacks/Makefile.in similarity index 100% rename from cgc_callbacks/Makefile.in rename to callbacks/Makefile.in diff --git a/cgc_callbacks/configure b/callbacks/configure similarity index 97% rename from cgc_callbacks/configure rename to callbacks/configure index 2d1aca75ebcee4c5f79bf9a57ff0c3242ac2564c..6e941ba8d9c10816912637afaa4b7e97434ee1fb 100755 --- a/cgc_callbacks/configure +++ b/callbacks/configure @@ -1,9 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for myconfig version-0.1. +# Generated by GNU Autoconf 2.68 for myconfig version-0.1. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -132,31 +134,6 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -190,8 +167,7 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" +test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -235,25 +211,21 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -355,14 +327,6 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -484,10 +448,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -522,16 +482,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -543,8 +503,28 @@ else as_mkdir_p=false fi -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -641,6 +621,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_debugging +enable_cgc ' ac_precious_vars='build_alias host_alias @@ -1105,6 +1086,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1260,6 +1243,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debugging enable -g when compiling + --enable-cgc enable -DCGC when compiling for CGC binaries Some influential environment variables: CC C compiler command @@ -1337,9 +1321,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF myconfig configure version-0.1 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.68 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1392,7 +1376,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by myconfig $as_me version-0.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -1762,7 +1746,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1802,7 +1786,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1855,7 +1839,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1896,7 +1880,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -1954,7 +1938,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -1998,7 +1982,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2444,7 +2428,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> -struct stat; +#include <sys/types.h> +#include <sys/stat.h> /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2535,8 +2520,13 @@ if test "${enable_debugging+set}" = set; then : enableval=$enable_debugging; fi -#AC_ARG_ENABLE([example], [ --enable-debugging enable -g when compiling]) -#AC_ARG_ENABLE([libc], [ --enable-libc enable $1 for building ]) +# Check whether --enable-cgc was given. +if test "${enable_cgc+set}" = set; then : + enableval=$enable_cgc; +fi + +#AC_ARG_ENABLE([example], [ --enable-debugging enable -g when compiling]) +#AC_ARG_ENABLE([libc], [ --enable-libc enable $1 for building ]) OPTIMIZE="-O3" if test "$enable_debugging" = yes; then @@ -3003,16 +2993,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -3072,16 +3062,28 @@ else as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -3103,7 +3105,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by myconfig $as_me version-0.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3156,10 +3158,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ myconfig config.status version-0.1 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -3236,7 +3238,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -4161,16 +4163,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -4230,16 +4232,28 @@ else as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4261,7 +4275,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by myconfig $as_me version-0.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4314,10 +4328,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ myconfig config.status version-0.1 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4394,7 +4408,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -4879,16 +4893,22 @@ fi fi } -LIB=$PEASOUP_HOME/cgc_callbacks/lib/callbacks.a +LIB=$ZIPR_HOME/callbacks/lib/callbacks.a AR=ar CC=gcc -CFLAGS="$OPTIMIZE -nostdinc -fPIC -I$PEASOUP_HOME/cgc_callbacks/libc/include " +CFLAGS="$OPTIMIZE -nostdinc -fPIC -I$ZIPR_HOME/callbacks/libc/include -fno-stack-protector" LD=gcc LDFLAGS="-r -nostdlib -fPIC" AS=nasm ASFLAGS="-felf" +if test "$enable_cgc" = yes; then + echo Enabling CGC build. + CFLAGS="$CFLAGS -DCGC" + ASFLAGS="$ASFLAGS -DCGC" +fi + # output lib's makefile, which is always needed. ac_config_files="$ac_config_files lib/Makefile" @@ -5335,16 +5355,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -5404,16 +5424,28 @@ else as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -5435,7 +5467,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by myconfig $as_me version-0.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5488,10 +5520,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ myconfig config.status version-0.1 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5568,7 +5600,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -6499,16 +6531,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -6568,16 +6600,28 @@ else as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -6599,7 +6643,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by myconfig $as_me version-0.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6652,10 +6696,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ myconfig config.status version-0.1 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -6732,7 +6776,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/cgc_callbacks/configure.in b/callbacks/configure.in similarity index 67% rename from cgc_callbacks/configure.in rename to callbacks/configure.in index ad2348ca92967dd9a1766efbd06967136c58d7f5..45277ba504c3f281176aaca302296cbf45cfd4d5 100644 --- a/cgc_callbacks/configure.in +++ b/callbacks/configure.in @@ -4,8 +4,9 @@ AC_INIT(myconfig, version-0.1) AC_PROG_CC AC_ARG_ENABLE([debugging], [ --enable-debugging enable -g when compiling]) -#AC_ARG_ENABLE([example], [ --enable-debugging enable -g when compiling]) -#AC_ARG_ENABLE([libc], [ --enable-libc enable $1 for building ]) +AC_ARG_ENABLE([cgc], [ --enable-cgc enable -DCGC when compiling for CGC binaries]) +#AC_ARG_ENABLE([example], [ --enable-debugging enable -g when compiling]) +#AC_ARG_ENABLE([libc], [ --enable-libc enable $1 for building ]) OPTIMIZE="-O3" if test "$enable_debugging" = yes; then @@ -34,16 +35,22 @@ enable_dir() fi } -LIB=$PEASOUP_HOME/cgc_callbacks/lib/callbacks.a +LIB=$ZIPR_HOME/callbacks/lib/callbacks.a AR=ar CC=gcc -CFLAGS="$OPTIMIZE -nostdinc -fPIC -I$PEASOUP_HOME/cgc_callbacks/libc/include " +CFLAGS="$OPTIMIZE -nostdinc -fPIC -I$ZIPR_HOME/callbacks/libc/include -fno-stack-protector" LD=gcc LDFLAGS="-r -nostdlib -fPIC" AS=nasm ASFLAGS="-felf" +if test "$enable_cgc" = yes; then + echo Enabling CGC build. + CFLAGS="$CFLAGS -DCGC" + ASFLAGS="$ASFLAGS -DCGC" +fi + # output lib's makefile, which is always needed. AC_OUTPUT(lib/Makefile) diff --git a/cgc_callbacks/example/Makefile.in b/callbacks/example/Makefile.in similarity index 100% rename from cgc_callbacks/example/Makefile.in rename to callbacks/example/Makefile.in diff --git a/cgc_callbacks/example/callback.c b/callbacks/example/callback.c similarity index 100% rename from cgc_callbacks/example/callback.c rename to callbacks/example/callback.c diff --git a/cgc_callbacks/lib/Makefile.in b/callbacks/lib/Makefile.in similarity index 100% rename from cgc_callbacks/lib/Makefile.in rename to callbacks/lib/Makefile.in diff --git a/cgc_callbacks/lib/crt.s b/callbacks/lib/crt.s similarity index 100% rename from cgc_callbacks/lib/crt.s rename to callbacks/lib/crt.s diff --git a/cgc_callbacks/libc/Makefile.in b/callbacks/libc/Makefile.in similarity index 100% rename from cgc_callbacks/libc/Makefile.in rename to callbacks/libc/Makefile.in diff --git a/cgc_callbacks/libc/include/cgc.h b/callbacks/libc/include/cgc.h similarity index 100% rename from cgc_callbacks/libc/include/cgc.h rename to callbacks/libc/include/cgc.h diff --git a/cgc_callbacks/libc/include/malloc.h b/callbacks/libc/include/malloc.h similarity index 100% rename from cgc_callbacks/libc/include/malloc.h rename to callbacks/libc/include/malloc.h diff --git a/cgc_callbacks/libc/include/stdint.h b/callbacks/libc/include/stdint.h similarity index 100% rename from cgc_callbacks/libc/include/stdint.h rename to callbacks/libc/include/stdint.h diff --git a/cgc_callbacks/libc/include/stdlib.h b/callbacks/libc/include/stdlib.h similarity index 100% rename from cgc_callbacks/libc/include/stdlib.h rename to callbacks/libc/include/stdlib.h diff --git a/callbacks/libc/include/syscall.h b/callbacks/libc/include/syscall.h new file mode 100644 index 0000000000000000000000000000000000000000..56dc0a04b857e3697403e3cf8a18cd12665707af --- /dev/null +++ b/callbacks/libc/include/syscall.h @@ -0,0 +1,2 @@ + +#define SYS_write 4 diff --git a/cgc_callbacks/libc/include/unistd.h b/callbacks/libc/include/unistd.h similarity index 100% rename from cgc_callbacks/libc/include/unistd.h rename to callbacks/libc/include/unistd.h diff --git a/cgc_callbacks/libc/src/Makefile.in b/callbacks/libc/src/Makefile.in similarity index 100% rename from cgc_callbacks/libc/src/Makefile.in rename to callbacks/libc/src/Makefile.in diff --git a/cgc_callbacks/libc/src/cgc.s b/callbacks/libc/src/cgc.s similarity index 84% rename from cgc_callbacks/libc/src/cgc.s rename to callbacks/libc/src/cgc.s index ae7c9996a38d7e85cf70a2a6c4bcabcc805056e6..8bc4f5336efce42699156d6a3645250b575a1b60 100644 --- a/cgc_callbacks/libc/src/cgc.s +++ b/callbacks/libc/src/cgc.s @@ -1,3 +1,4 @@ +%ifdef CGC section .text @@ -112,3 +113,24 @@ cgc_random: pop ebx ret +%else + +global syscall +syscall: + push edi + push esi + push ebx + mov edi, [esp+0x24] + mov esi, [esp+0x20] + mov edx, [esp+0x1c] + mov ecx, [esp+0x18] + mov ebx, [esp+0x14] + mov eax, [esp+0x10] + int 0x80 + pop ebx + pop esi + pop edi + ret + + +%endif diff --git a/cgc_callbacks/libc/src/malloc.c b/callbacks/libc/src/malloc.c similarity index 86% rename from cgc_callbacks/libc/src/malloc.c rename to callbacks/libc/src/malloc.c index 3c59ea5b99038d36a97b103b6421d097c2a596a3..8fd0202c6c73ff208678b4f80d46d8dd2beb24b7 100644 --- a/cgc_callbacks/libc/src/malloc.c +++ b/callbacks/libc/src/malloc.c @@ -3,8 +3,11 @@ void *malloc(size_t size) { +#ifdef CGC void* ret=0; if(cgc_allocate(size, FALSE, &ret)); return ret; return NULL; +#else +#endif } diff --git a/cgc_callbacks/libc/src/unistd.c b/callbacks/libc/src/unistd.c similarity index 64% rename from cgc_callbacks/libc/src/unistd.c rename to callbacks/libc/src/unistd.c index 9305eafca44008b6258400f3d9c8593cb43960f7..fb76f5e58f8db551ac99c46550d2d2b0ebc0a6f3 100644 --- a/cgc_callbacks/libc/src/unistd.c +++ b/callbacks/libc/src/unistd.c @@ -1,10 +1,15 @@ #include <unistd.h> +#include <syscall.h> ssize_t write(int fd, const void* buf, size_t count) { +#ifdef CGC ssize_t ret=0; cgc_transmit(fd,buf,count,&ret); return ret; +#else + syscall(SYS_write,fd,buf,count); +#endif }