aboutsummaryrefslogtreecommitdiff
path: root/gold/output.cc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-09-18 13:23:34 +0200
committerMartin Liska <mliska@suse.cz>2019-11-26 17:20:10 +0100
commit5fa5f8f5fe494ba4fe98c11899a5464cd164ec75 (patch)
tree451d1fa4e113336dd195ecb9628767da592d9553 /gold/output.cc
parent239b426b11425c4bd6b36aa7fd92a01e74fd42cb (diff)
downloadgdb-5fa5f8f5fe494ba4fe98c11899a5464cd164ec75.zip
gdb-5fa5f8f5fe494ba4fe98c11899a5464cd164ec75.tar.gz
gdb-5fa5f8f5fe494ba4fe98c11899a5464cd164ec75.tar.bz2
Introduce new .text.sorted.* sections.
gold/ChangeLog: 2019-11-26 Martin Liska <mliska@suse.cz> * layout.cc (Layout::special_ordering_of_input_section): Add ".text.sorted". * output.cc: Special case ".text.sorted". * testsuite/section_sorting_name.cc: Cover also .text.sorted subsections. * testsuite/section_sorting_name.sh: Likewise. ld/ChangeLog: 2019-11-26 Martin Liska <mliska@suse.cz> * scripttempl/arclinux.sc: Add .text.sorted.* which is sorted by default. * scripttempl/elf.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * testsuite/ld-arm/arm-no-rel-plt.ld: Expect .text.sorted.* in the default linker script. * testsuite/ld-arm/fdpic-main.ld: Likewise. * testsuite/ld-arm/fdpic-shared.ld: Likewise.
Diffstat (limited to 'gold/output.cc')
-rw-r--r--gold/output.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gold/output.cc b/gold/output.cc
index df80587..428a880 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -3547,8 +3547,10 @@ Output_section::Input_section_sort_section_prefix_special_ordering_compare
const Output_section::Input_section_sort_entry& s2) const
{
// Some input section names have special ordering requirements.
- int o1 = Layout::special_ordering_of_input_section(s1.section_name().c_str());
- int o2 = Layout::special_ordering_of_input_section(s2.section_name().c_str());
+ const char *s1_section_name = s1.section_name().c_str();
+ const char *s2_section_name = s2.section_name().c_str();
+ int o1 = Layout::special_ordering_of_input_section(s1_section_name);
+ int o2 = Layout::special_ordering_of_input_section(s2_section_name);
if (o1 != o2)
{
if (o1 < 0)
@@ -3558,6 +3560,8 @@ Output_section::Input_section_sort_section_prefix_special_ordering_compare
else
return o1 < o2;
}
+ else if (is_prefix_of(".text.sorted", s1_section_name))
+ return strcmp(s1_section_name, s2_section_name) <= 0;
// Keep input order otherwise.
return s1.index() < s2.index();