aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2013-01-24 18:49:55 +0000
committerSriraman Tallam <tmsriram@google.com>2013-01-24 18:49:55 +0000
commitc6ac678db54ed727cb673a87beeb7a41bdf13182 (patch)
treeb2a220a0034d74e463386bb5efa8e1ac0a2fd697 /gold/testsuite
parent45e6c716a91b609472e7b807347f9ed3a86c8113 (diff)
downloadgdb-c6ac678db54ed727cb673a87beeb7a41bdf13182.zip
gdb-c6ac678db54ed727cb673a87beeb7a41bdf13182.tar.gz
gdb-c6ac678db54ed727cb673a87beeb7a41bdf13182.tar.bz2
Default text reordering fix with a flag to turn it off.
2013-01-24 Sriraman Tallam <tmsriram@google.com> * layout.cc (Layout::layout): Check for option text_reorder. (Layout::make_output_section): Ditto. * options.h (text_reorder): New option. * output.cc (Input_section_sort_compare): Remove special ordering of section names. (Output_section:: Input_section_sort_section_name_special_ordering_compare:: operator()): New function. (Output_section::sort_attached_input_sections): Use new sort function for .text. * output.h (Input_section_sort_section_name_special_ordering_compare): New struct. * testsuite/Makefile.am (text_section_grouping): Test option --no-text-reorder * testsuite/Makefile.in: Regenerate. * testsuite/text_section_grouping.sh: Check order of functions without default text reordering.
Diffstat (limited to 'gold/testsuite')
-rw-r--r--gold/testsuite/Makefile.am10
-rw-r--r--gold/testsuite/Makefile.in8
-rwxr-xr-xgold/testsuite/text_section_grouping.sh8
3 files changed, 22 insertions, 4 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index fa1161f..499dba6 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -259,14 +259,18 @@ final_layout.stdout: final_layout
$(TEST_NM) -n --synthetic final_layout > final_layout.stdout
check_SCRIPTS += text_section_grouping.sh
-check_DATA += text_section_grouping.stdout
-MOSTLYCLEANFILES += text_section_grouping
+check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
+MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
text_section_grouping.o: text_section_grouping.cc
$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
text_section_grouping: text_section_grouping.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ text_section_grouping.o
+text_section_no_grouping: text_section_grouping.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
text_section_grouping.stdout: text_section_grouping
- $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
+ $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
+text_section_no_grouping.stdout: text_section_no_grouping
+ $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
check_PROGRAMS += icf_virtual_function_folding_test
MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 51bdb27..a8129f9 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -113,6 +113,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test_2.stdout \
@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 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_preemptible_functions_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_string_merge_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_sht_rel_addend_test.stdout \
@@ -128,6 +129,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ final_layout_sequence.txt \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ final_layout_script.lds \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ text_section_grouping \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ text_section_no_grouping \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_virtual_function_folding_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_virtual_function_folding_test.map \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_preemptible_functions_test \
@@ -4376,8 +4378,12 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@text_section_grouping: text_section_grouping.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ text_section_grouping.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@text_section_no_grouping: text_section_grouping.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@text_section_grouping.stdout: text_section_grouping
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@text_section_no_grouping.stdout: text_section_no_grouping
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
diff --git a/gold/testsuite/text_section_grouping.sh b/gold/testsuite/text_section_grouping.sh
index a79836c..84ebe4c 100755
--- a/gold/testsuite/text_section_grouping.sh
+++ b/gold/testsuite/text_section_grouping.sh
@@ -26,6 +26,8 @@
# according to prefix. .text.unlikely, .text.startup and .text.hot should
# be grouped and placed together.
+# Also check if the functions do not get grouped with option --no-text-reorder.
+
set -e
check()
@@ -63,3 +65,9 @@ check text_section_grouping.stdout "unlikely_bar" "startup_bar"
check text_section_grouping.stdout "startup_bar" "hot_bar"
check text_section_grouping.stdout "unlikely_foo" "startup_bar"
check text_section_grouping.stdout "startup_foo" "hot_bar"
+
+check text_section_no_grouping.stdout "hot_foo" "startup_foo"
+check text_section_no_grouping.stdout "startup_foo" "unlikely_foo"
+check text_section_no_grouping.stdout "unlikely_foo" "hot_bar"
+check text_section_no_grouping.stdout "hot_bar" "startup_bar"
+check text_section_no_grouping.stdout "startup_bar" "unlikely_bar"