From 81bf537bb9e5bbc1bd8fe5a002b04502cd9c1e94 Mon Sep 17 00:00:00 2001 From: jdh8d <jdh8d@git.zephyr-software.com> Date: Wed, 5 Apr 2017 16:42:48 +0000 Subject: [PATCH] bug fixes and first tested version of eh-rewriting. Former-commit-id: efd748477c76d5e0862dbfd29b7a7fae5a7fca8c --- .gitattributes | 1 + c++_examples/testit.sh | 41 +++++++++++++++++++++++++++++++ tools/db/pdb.createprogram.tbl | 1 + tools/eh_frame_tools/eh_to_bin.sh | 2 +- 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 c++_examples/testit.sh mode change 100644 => 100755 tools/eh_frame_tools/eh_to_bin.sh diff --git a/.gitattributes b/.gitattributes index 83716642c..2ae02134e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,6 +18,7 @@ c++_examples/newdelete4.cpp -text c++_examples/newdelete5.cpp -text c++_examples/newdelete6.cpp -text c++_examples/simple_throw.cpp -text +c++_examples/testit.sh -text c++_examples/throw.cpp -text cgc_spri/Makefile -text cgc_spri/spawn_with_spri_open.c -text diff --git a/c++_examples/testit.sh b/c++_examples/testit.sh new file mode 100755 index 000000000..84043898a --- /dev/null +++ b/c++_examples/testit.sh @@ -0,0 +1,41 @@ +#!/bin/bash + + +compare() +{ + env $1 ./a.out > good.txt 2>&1 + env $1 ./xxx > xform.txt 2>&1 + + cmp good.txt xform.txt > /dev/null 2>&1 + + if [ $? != 0 ]; then + echo "Failed test: $1"; + diff good.txt xform.txt + exit 2 + fi +} + +src_files="simple_throw.cpp throw.cpp" +options="-Os -O0 -O1 -O2 -O3" +throws="THROW_INT THROW_CHAR THROW_FLOAT" + +for src in $src_files +do + echo "Trying $src" + + for option in $options + do + echo "With $option" + g++ $option $src + rm -Rf peasoup_executable_direc* + EHIR_VERBOSE=1 $PSZ ./a.out ./xxx --step-option fill_in_indtargs:--split-eh-frame --step-option zipr:'--add-sections true' + + compare + + for throw in $throws + do + compare $throw=1 + done + + done +done diff --git a/tools/db/pdb.createprogram.tbl b/tools/db/pdb.createprogram.tbl index 98d2de1d9..afa1d7cf6 100644 --- a/tools/db/pdb.createprogram.tbl +++ b/tools/db/pdb.createprogram.tbl @@ -120,5 +120,6 @@ CREATE TABLE #EHCS# ( ehcs_id integer, -- id of this object. tt_encoding integer, -- the encoding of the type table. + has_cleanup integer, -- whether this callsite has cleanups, even if the type table is empty. lp_insn_id integer -- the landing pad instruction's id. ); diff --git a/tools/eh_frame_tools/eh_to_bin.sh b/tools/eh_frame_tools/eh_to_bin.sh old mode 100644 new mode 100755 index e8ec91e18..054b4b728 --- a/tools/eh_frame_tools/eh_to_bin.sh +++ b/tools/eh_frame_tools/eh_to_bin.sh @@ -4,7 +4,7 @@ infile=$1 addr=$2 outfile=$3 -gcc $infile -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=$addr -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,${PEASOUP_HOME}/tools/eh_frame_tools/eh_frame.ls -o $outfile || exit +gcc $infile -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=$addr -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,${PEASOUP_HOME}/tools/eh_frame_tools/eh_frame.ls -o $outfile -Wl,-Map,$outfile.map || exit #eu-readelf -S ./a.out objcopy --rename-section eh_frame_hdr=.eh_frame_hdr --rename-section eh_frame=.eh_frame --rename-section gcc_except_table=.gcc_except_table $outfile #eu-readelf -S -w ./b.out -- GitLab