aboutsummaryrefslogtreecommitdiff
path: root/gold/script-sections.h
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-04-09 17:32:58 +0000
committerDoug Kwan <dougkwan@google.com>2010-04-09 17:32:58 +0000
commit1e5d2fb127950dc92a01fe2bbbd12a219bf2286c (patch)
tree9d80c60849c9d2bf643a34f3cb9172c95fe32e4d /gold/script-sections.h
parent86da934b14f15b2262b82308130829f68b0791c0 (diff)
downloadgdb-1e5d2fb127950dc92a01fe2bbbd12a219bf2286c.zip
gdb-1e5d2fb127950dc92a01fe2bbbd12a219bf2286c.tar.gz
gdb-1e5d2fb127950dc92a01fe2bbbd12a219bf2286c.tar.bz2
2010-04-09 Doug Kwan <dougkwan@google.com>
* layout.cc (Layout::choose_output_section): Handle script section types. (Layout::make_output_section_for_script): Add section type parameter. Handle script section types. * layout.h (Layout::make_output_section_for_script): Add section type parameter. * output.cc (Output_section::Output_section): Initialize data member is_noload_. (Output_section::do_reset_address_and_file_offset): Do not set address to 0 if section is a NOLOAD section. * output.h (Output_section::is_noload): New method. (Output_section::set_is_noload): Ditto. (Output_section::is_noload_): New data member. * script-c.h (Script_section_type): New enum type. (struct Parser_output_section_header): Add new file section_type. * script-sections.cc (Sections_element::output_section_name): Add parameter for returning script section type. (Output_section_definition::output_section_name): Ditto. (Output_section_definition::section_type)P; New method. (Output_section_definiton::script_section_type_name): Ditto. (Output_section_definition::script_section_type_): New data member. (Output_section_definition::Output_section_definition): Initialize data member Output_section_definition::script_section_type_. (Output_section_definition::create_sections): Pass script section type to Layout::make_output_section_for_script. (Output_section_definition::output_section_name): Return script section type to caller. (Output_section_definition::set_section_address): Do not advance dot value and load address if section type is NOLOAD. Set address of NOLOAD sections regardless of section flags. (Output_section_definition::print): Print section type if it is not SCRIPT_SECTION_TYPE_NONE. (Output_section_definition::section_type): New method. (Output_section_definition::script_section_type_name): Ditto. (Script_sections::output_section_name): Add new parameter PSECTION_TYPE for returning script section type. Pass it to section elements. Handle discard sections. (Sort_output_sections::operator()): Handle NOLOAD sections. * script-sections.h (Script_sections::Section_type): New enum type. (Script_sections::output_section_name): Add a new parameter for returning script section type. * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT, INFO and NOLOAD. * yyscript.y (union): Add new field SECTION_TYPE. (COPY, DSECT, INFO, NOLOAD): New tokens. (opt_address_and_section_type): Change type to output_section_header. (section_type): New non-terminal (section_header): Handle section type. (opt_address_and_section_type): Return section type value.
Diffstat (limited to 'gold/script-sections.h')
-rw-r--r--gold/script-sections.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/gold/script-sections.h b/gold/script-sections.h
index c0d1d08..725d1a2 100644
--- a/gold/script-sections.h
+++ b/gold/script-sections.h
@@ -52,6 +52,20 @@ class Script_sections
typedef std::list<Sections_element*> Sections_elements;
public:
+
+ // Logical script section types. We map section types returned by the
+ // parser into these since some section types have the same semantics.
+ enum Section_type
+ {
+ // No section type specified.
+ ST_NONE,
+ // Section is NOLOAD. We allocate space in the output but section
+ // is not loaded in runtime.
+ ST_NOLOAD,
+ // No space is allocated to section.
+ ST_NOALLOC
+ };
+
Script_sections();
// Start a SECTIONS clause.
@@ -147,9 +161,13 @@ class Script_sections
// 3) If the input section is not mapped by the SECTIONS clause,
// this returns SECTION_NAME, and sets *OUTPUT_SECTION_SLOT to
// NULL.
+ // PSCRIPT_SECTION_TYPE points to a location for returning the section
+ // type specified in script. This can be SCRIPT_SECTION_TYPE_NONE if
+ // no type is specified.
const char*
output_section_name(const char* file_name, const char* section_name,
- Output_section*** output_section_slot);
+ Output_section*** output_section_slot,
+ Section_type* pscript_section_type);
// Place a marker for an orphan output section into the SECTIONS
// clause.