diff options
author | Sriraman Tallam <tmsriram@google.com> | 2011-09-29 23:45:57 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2011-09-29 23:45:57 +0000 |
commit | f0558624db8e79622bb71ea5279ec6b5f8c9bc79 (patch) | |
tree | d197f7cab34bbcca71419dd08cdc05e47d661d0d /gold/plugin.cc | |
parent | a7dac15368485853f4bd463352afb9b49517b624 (diff) | |
download | gdb-f0558624db8e79622bb71ea5279ec6b5f8c9bc79.zip gdb-f0558624db8e79622bb71ea5279ec6b5f8c9bc79.tar.gz gdb-f0558624db8e79622bb71ea5279ec6b5f8c9bc79.tar.bz2 |
2011-09-29 Sriraman Tallam <tmsriram@google.com>
* layout.h (section_order_map_): New member.
(get_section_order_map): New member function.
* output.cc (Output_section::add_input_section): Check for patterns
only when --section-ordering-file is specified.
* gold.cc (queue_middle_tasks): Delay updating order of sections till
output_sections have been formed.
* layout.cc (Layout_Layout): Initialize section_order_map_.
* plugin.cc (update_section_order): Store order in order_map. Do not
update the order.
* testsuite/Makefile.am: Add test case for plugin_final_layout.
* testsuite/Makefile.in: Regenerate.
* testsuite/plugin_section_order.c: New file.
* testsuite/plugin_final_layout.cc: New file.
* testsuite/plugin_final_layout.sh: New file.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r-- | gold/plugin.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc index 3ccd8d0..b5880a1 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -1630,7 +1630,7 @@ get_input_section_contents(const struct ld_plugin_section section, // which they should appear in the final layout. static enum ld_plugin_status -update_section_order(const struct ld_plugin_section *section_list, +update_section_order(const struct ld_plugin_section* section_list, unsigned int num_sections) { gold_assert(parameters->options().has_plugins()); @@ -1641,8 +1641,14 @@ update_section_order(const struct ld_plugin_section *section_list, if (section_list == NULL) return LDPS_ERR; - std::map<Section_id, unsigned int> order_map; + Layout* layout = parameters->options().plugins()->layout(); + gold_assert (layout != NULL); + std::map<Section_id, unsigned int>* order_map + = layout->get_section_order_map(); + + /* Store the mapping from Section_id to section position in layout's + order_map to consult after output sections are added. */ for (unsigned int i = 0; i < num_sections; ++i) { Object* obj = parameters->options().plugins()->get_elf_object( @@ -1651,17 +1657,9 @@ update_section_order(const struct ld_plugin_section *section_list, return LDPS_BAD_HANDLE; unsigned int shndx = section_list[i].shndx; Section_id secn_id(obj, shndx); - order_map[secn_id] = i + 1; + (*order_map)[secn_id] = i + 1; } - Layout* layout = parameters->options().plugins()->layout(); - gold_assert (layout != NULL); - - for (Layout::Section_list::const_iterator p = layout->section_list().begin(); - p != layout->section_list().end(); - ++p) - (*p)->update_section_layout(order_map); - return LDPS_OK; } |