aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-03-12 22:46:19 +0000
committerAlan Modra <amodra@gmail.com>2013-03-12 22:46:19 +0000
commit4d9aa1551545dd5365d35a0844d3b7a5a35d02f3 (patch)
treea7dca097cb31fbcdcf14394961a242fc5c185850 /gold/testsuite
parent2d450646ca4c6972bf1d2c82c9e4453fd3381339 (diff)
downloadgdb-4d9aa1551545dd5365d35a0844d3b7a5a35d02f3.zip
gdb-4d9aa1551545dd5365d35a0844d3b7a5a35d02f3.tar.gz
gdb-4d9aa1551545dd5365d35a0844d3b7a5a35d02f3.tar.bz2
* powerpc.cc (is_branch_reloc): Forward declare.
(Target_powerpc::do_can_check_for_function_pointers): New predicate. (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return false for 64-bit, true for 32-bit non-branch relocs. (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise. * testsuite/Makefile.am (icf_test): Use linker map file instead of nm output. (icf_safe_test): Generate linker map file as well as nm output. (icf_safe_so_test): Likewise. * testsuite/Makefile.in: Regenerate. * testsuite/icf_test.sh: Parse linker map file to determine section folding. * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC. * testsuite/icf_safe_so_test.sh: Likewise. (X86_32_or_ARM_specific_safe_fold): Merge into.. (arch_specific_safe_fold): ..this. (X86_64_specific_safe_fold): Delete unused function.
Diffstat (limited to 'gold/testsuite')
-rw-r--r--gold/testsuite/Makefile.am56
-rw-r--r--gold/testsuite/Makefile.in43
-rwxr-xr-xgold/testsuite/icf_safe_so_test.sh51
-rwxr-xr-xgold/testsuite/icf_safe_test.sh30
-rwxr-xr-xgold/testsuite/icf_test.sh22
5 files changed, 119 insertions, 83 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 481ed2c..5b5c86b 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -53,6 +53,26 @@ TEST_AR = $(top_builddir)/../binutils/ar
TEST_NM = $(top_builddir)/../binutils/nm-new
TEST_AS = $(top_builddir)/../gas/as-new
+# Make the default target available to scripts as $DEFAULT_TARGET.
+if DEFAULT_TARGET_ARM
+export DEFAULT_TARGET = arm
+endif
+if DEFAULT_TARGET_I386
+export DEFAULT_TARGET = i386
+endif
+if DEFAULT_TARGET_POWERPC
+export DEFAULT_TARGET = powerpc
+endif
+if DEFAULT_TARGET_SPARC
+export DEFAULT_TARGET = sparc
+endif
+if DEFAULT_TARGET_X86_64
+export DEFAULT_TARGET = x86_64
+endif
+if DEFAULT_TARGET_TILEGX
+export DEFAULT_TARGET = tilegx
+endif
+
if PLUGINS
LIBDL = -ldl
endif
@@ -201,14 +221,12 @@ pr14265.stdout: pr14265
$(TEST_NM) --format=bsd --numeric-sort $< > $@
check_SCRIPTS += icf_test.sh
-check_DATA += icf_test.stdout
-MOSTLYCLEANFILES += icf_test
+check_DATA += icf_test.map
+MOSTLYCLEANFILES += icf_test icf_test.map
icf_test.o: icf_test.cc
$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
-icf_test: icf_test.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
-icf_test.stdout: icf_test
- $(TEST_NM) -C icf_test > icf_test.stdout
+icf_test icf_test.map: icf_test.o gcctestdir/ld
+ $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
check_SCRIPTS += icf_keep_unique_test.sh
check_DATA += icf_keep_unique_test.stdout
@@ -218,31 +236,31 @@ icf_keep_unique_test.o: icf_keep_unique_test.cc
icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
icf_keep_unique_test.stdout: icf_keep_unique_test
- $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
+ $(TEST_NM) -C $< > $@
check_SCRIPTS += icf_safe_test.sh
-check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
-MOSTLYCLEANFILES += icf_safe_test
+check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
+MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
icf_safe_test.o: icf_safe_test.cc
$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
-icf_safe_test: icf_safe_test.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
+icf_safe_test icf_safe_test.map: icf_safe_test.o gcctestdir/ld
+ $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
icf_safe_test_1.stdout: icf_safe_test
- $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
+ $(TEST_NM) $< > $@
icf_safe_test_2.stdout: icf_safe_test
- $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
+ $(TEST_READELF) -h $< > $@
check_SCRIPTS += icf_safe_so_test.sh
-check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
-MOSTLYCLEANFILES += icf_safe_so_test
+check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
+MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
icf_safe_so_test.o: icf_safe_so_test.cc
$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
-icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
+icf_safe_so_test icf_safe_so_test.map: icf_safe_so_test.o gcctestdir/ld
+ $(CXXLINK) -o icf_safe_so_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
icf_safe_so_test_1.stdout: icf_safe_so_test
- $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
+ $(TEST_NM) $< > $@
icf_safe_so_test_2.stdout: icf_safe_so_test
- $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
+ $(TEST_READELF) -h $< > $@
check_SCRIPTS += final_layout.sh
check_DATA += final_layout.stdout
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index bfb7764..ec0acb9 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -105,12 +105,14 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_comdat_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_tls_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_orphan_section_test.stdout \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr14265.stdout icf_test.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr14265.stdout icf_test.map \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_keep_unique_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_test_1.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_test_2.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_test.map \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test_1.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test_2.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test.map \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ final_layout.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ text_section_grouping.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ text_section_no_grouping.stdout \
@@ -123,8 +125,11 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test.cmdline \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_comdat_test gc_tls_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_orphan_section_test pr14265 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test icf_keep_unique_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_test icf_safe_so_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test icf_test.map \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_keep_unique_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_test icf_safe_test.map \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test.map \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ final_layout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ final_layout_sequence.txt \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ final_layout_script.lds \
@@ -4270,6 +4275,14 @@ uninstall-am:
recheck recheck-html tags uninstall uninstall-am
+# Make the default target available to scripts as $DEFAULT_TARGET.
+@DEFAULT_TARGET_ARM_TRUE@export DEFAULT_TARGET = arm
+@DEFAULT_TARGET_I386_TRUE@export DEFAULT_TARGET = i386
+@DEFAULT_TARGET_POWERPC_TRUE@export DEFAULT_TARGET = powerpc
+@DEFAULT_TARGET_SPARC_TRUE@export DEFAULT_TARGET = sparc
+@DEFAULT_TARGET_X86_64_TRUE@export DEFAULT_TARGET = x86_64
+@DEFAULT_TARGET_TILEGX_TRUE@export DEFAULT_TARGET = tilegx
+
# The unittests themselves
# Infrastucture needed for the unittests: a directory where the linker
@@ -4338,32 +4351,30 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) --format=bsd --numeric-sort $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_test.o: icf_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
-@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_test: icf_test.o gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
-@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_test.stdout: icf_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -C icf_test > icf_test.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_test icf_test.map: icf_test.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_keep_unique_test.o: icf_keep_unique_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_keep_unique_test.stdout: icf_keep_unique_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -C $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_test.o: icf_safe_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
-@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_test: icf_safe_test.o gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_test icf_safe_test.map: icf_safe_test.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_test_1.stdout: icf_safe_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_test_2.stdout: icf_safe_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -h $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_so_test.o: icf_safe_so_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
-@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
+@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_so_test icf_safe_so_test.map: icf_safe_so_test.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -o icf_safe_so_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_so_test_1.stdout: icf_safe_so_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_safe_so_test_2.stdout: icf_safe_so_test
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -h $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@final_layout.o: final_layout.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@final_layout_sequence.txt:
diff --git a/gold/testsuite/icf_safe_so_test.sh b/gold/testsuite/icf_safe_so_test.sh
index 2c88250..813248e 100755
--- a/gold/testsuite/icf_safe_so_test.sh
+++ b/gold/testsuite/icf_safe_so_test.sh
@@ -67,41 +67,36 @@ check_fold()
return 0
fi
- func_addr_1=`grep $2 $1 | awk '{print $1}'`
- func_addr_2=`grep $3 $1 | awk '{print $1}'`
- if [ $func_addr_1 != $func_addr_2 ];
- then
- echo "Safe Identical Code Folding did not fold " $2 "and" $3
- exit 1
- fi
+ awk "
+BEGIN { discard = 0; }
+/^Discarded input/ { discard = 1; }
+/^Memory map/ { discard = 0; }
+/.*\\.text\\..*($2|$3).*/ { act[discard] = act[discard] \" \" \$0; }
+END {
+ # printf \"kept\" act[0] \"\\nfolded\" act[1] \"\\n\";
+ if (length(act[0]) == 0 || length(act[1]) == 0)
+ {
+ printf \"Safe Identical Code Folding did not fold $2 and $3\\n\"
+ exit 1;
+ }
+ }" $4
}
arch_specific_safe_fold()
{
- if [ $1 -eq 0 ];
+ grep -e "Intel 80386" -e "ARM" -e "PowerPC" $1 > /dev/null 2>&1
+ if [ $? -eq 0 ];
then
- check_fold $2 $3 $4
+ check_fold $2 $4 $5 $3
else
- check_nofold $2 $3 $4
+ check_nofold $2 $4 $5
fi
}
-X86_32_or_ARM_specific_safe_fold()
-{
- grep -e "Intel 80386" -e "ARM" $1 > /dev/null 2>&1
- arch_specific_safe_fold $? $2 $3 $4
-}
-
-X86_64_specific_safe_fold()
-{
- grep -e "Advanced Micro Devices X86-64" $1 > /dev/null 2>&1
- arch_specific_safe_fold $? $2 $3 $4
-}
-
-X86_32_or_ARM_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout "foo_prot" "foo_hidden"
-X86_32_or_ARM_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout "foo_prot" "foo_internal"
-X86_32_or_ARM_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout "foo_prot" "foo_static"
-X86_32_or_ARM_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout "foo_hidden" "foo_internal"
-X86_32_or_ARM_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout "foo_hidden" "foo_static"
-X86_32_or_ARM_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout "foo_internal" "foo_static"
+arch_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout icf_safe_so_test.map "foo_prot" "foo_hidden"
+arch_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout icf_safe_so_test.map "foo_prot" "foo_internal"
+arch_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout icf_safe_so_test.map "foo_prot" "foo_static"
+arch_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout icf_safe_so_test.map "foo_hidden" "foo_internal"
+arch_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout icf_safe_so_test.map "foo_hidden" "foo_static"
+arch_specific_safe_fold icf_safe_so_test_2.stdout icf_safe_so_test_1.stdout icf_safe_so_test.map "foo_internal" "foo_static"
check_nofold icf_safe_so_test_1.stdout "foo_glob" "bar_glob"
diff --git a/gold/testsuite/icf_safe_test.sh b/gold/testsuite/icf_safe_test.sh
index 3b2795a..fe224f6 100755
--- a/gold/testsuite/icf_safe_test.sh
+++ b/gold/testsuite/icf_safe_test.sh
@@ -40,28 +40,34 @@ check_nofold()
check_fold()
{
- func_addr_1=`grep $2 $1 | awk '{print $1}'`
- func_addr_2=`grep $3 $1 | awk '{print $1}'`
- if [ $func_addr_1 != $func_addr_2 ]
- then
- echo "Safe Identical Code Folding did not fold " $2 "and" $3
- exit 1
- fi
+ awk "
+BEGIN { discard = 0; }
+/^Discarded input/ { discard = 1; }
+/^Memory map/ { discard = 0; }
+/.*\\.text\\..*($2|$3).*/ { act[discard] = act[discard] \" \" \$0; }
+END {
+ # printf \"kept\" act[0] \"\\nfolded\" act[1] \"\\n\";
+ if (length(act[0]) == 0 || length(act[1]) == 0)
+ {
+ printf \"Safe Identical Code Folding did not fold $2 and $3\\n\"
+ exit 1;
+ }
+ }" $1
}
arch_specific_safe_fold()
{
- grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e "ARM" -e "TILE" $2`
+ grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e "ARM" -e "TILE" -e "PowerPC" $2`
if [ $? -eq 0 ];
then
- check_fold $1 $3 $4
+ check_fold $3 $4 $5
else
- check_nofold $1 $3 $4
+ check_nofold $1 $4 $5
fi
}
arch_specific_safe_fold icf_safe_test_1.stdout icf_safe_test_2.stdout \
- "kept_func_1" "kept_func_2"
-check_fold icf_safe_test_1.stdout "_ZN1AD1Ev" "_ZN1AC1Ev"
+ icf_safe_test.map "kept_func_1" "kept_func_2"
+check_fold icf_safe_test.map "_ZN1AD2Ev" "_ZN1AC2Ev"
check_nofold icf_safe_test_1.stdout "kept_func_3" "kept_func_1"
check_nofold icf_safe_test_1.stdout "kept_func_3" "kept_func_2"
diff --git a/gold/testsuite/icf_test.sh b/gold/testsuite/icf_test.sh
index 5f1481c..50abd90 100755
--- a/gold/testsuite/icf_test.sh
+++ b/gold/testsuite/icf_test.sh
@@ -28,13 +28,19 @@
check()
{
- func_addr_1=`grep $2 $1 | awk '{print $1}'`
- func_addr_2=`grep $3 $1 | awk '{print $1}'`
- if [ $func_addr_1 != $func_addr_2 ]
- then
- echo "Identical Code Folding failed to fold" $2 "and" $3
- exit 1
- fi
+ awk "
+BEGIN { discard = 0; }
+/^Discarded input/ { discard = 1; }
+/^Memory map/ { discard = 0; }
+/.*\\.text\\..*($2|$3).*/ { act[discard] = act[discard] \" \" \$0; }
+END {
+ # printf \"kept\" act[0] \"\\nfolded\" act[1] \"\\n\";
+ if (length(act[0]) == 0 || length(act[1]) == 0)
+ {
+ printf \"Identical Code Folding did not fold $2 and $3\\n\"
+ exit 1;
+ }
+ }" $1
}
-check icf_test.stdout "folded_func" "kept_func"
+check icf_test.map "folded_func" "kept_func"