aboutsummaryrefslogtreecommitdiff
path: root/gold/script-sections.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-02-04 05:43:05 +0000
committerIan Lance Taylor <iant@google.com>2008-02-04 05:43:05 +0000
commita445fddf828b0e8251fbdce91bc9372e7efd24f0 (patch)
tree6af0ee8254a9432643798126eef663603d92eb08 /gold/script-sections.h
parentd16c732117ed4b752abd51dd1598c9cec9d2b26c (diff)
downloadgdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.zip
gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.tar.gz
gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.tar.bz2
Fully implement the SECTIONS clause.
Diffstat (limited to 'gold/script-sections.h')
-rw-r--r--gold/script-sections.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/gold/script-sections.h b/gold/script-sections.h
index 4344325..6ac4303 100644
--- a/gold/script-sections.h
+++ b/gold/script-sections.h
@@ -37,6 +37,8 @@ struct Input_section_spec;
class Expression;
class Sections_element;
class Output_section_definition;
+class Output_section;
+class Output_segment;
class Script_sections
{
@@ -79,6 +81,11 @@ class Script_sections
void
add_symbol_assignment(const char* name, size_t length, Expression* value,
bool provide, bool hidden);
+
+ // Add an assignment to the special dot symbol.
+ void
+ add_dot_assignment(Expression* value);
+
// Add an assertion.
void
add_assertion(Expression* check, const char* message, size_t messagelen);
@@ -91,6 +98,42 @@ class Script_sections
void
add_input_section(const Input_section_spec* spec, bool keep);
+ // Add any symbols we are defining to the symbol table.
+ void
+ add_symbols_to_table(Symbol_table*);
+
+ // Finalize symbol values and check assertions.
+ void
+ finalize_symbols(Symbol_table* symtab, const Layout* layout);
+
+ // Find the name of the output section to use for an input file name
+ // and section name. This returns a name, and sets
+ // *OUTPUT_SECTION_SLOT to point to the address where the actual
+ // output section may be stored.
+ // 1) If the input section should be discarded, this returns NULL
+ // and sets *OUTPUT_SECTION_SLOT to NULL.
+ // 2) If the input section is mapped by the SECTIONS clause, this
+ // returns the name to use for the output section (in permanent
+ // storage), and sets *OUTPUT_SECTION_SLOT to point to where the
+ // output section should be stored. **OUTPUT_SECTION_SLOT will be
+ // non-NULL if we have seen this output section already.
+ // 3) If the input section is not mapped by the SECTIONS clause,
+ // this returns SECTION_NAME, and sets *OUTPUT_SECTION_SLOT to
+ // NULL.
+ const char*
+ output_section_name(const char* file_name, const char* section_name,
+ Output_section*** output_section_slot);
+
+ // Place a marker for an orphan output section into the SECTIONS
+ // clause.
+ void
+ place_orphan(Output_section* os);
+
+ // Set the addresses of all the output sections. Return the segment
+ // which holds the file header and segment headers, if any.
+ Output_segment*
+ set_section_addresses(Symbol_table*, Layout*);
+
// Print the contents to the FILE. This is for debugging.
void
print(FILE*) const;
@@ -98,6 +141,18 @@ class Script_sections
private:
typedef std::vector<Sections_element*> Sections_elements;
+ // Create segments.
+ Output_segment*
+ create_segments(Layout*);
+
+ // Create PT_NOTE and PT_TLS segments.
+ void
+ create_note_and_tls_segments(Layout*, const std::vector<Output_section*>*);
+
+ // Return whether the section is a BSS section.
+ static bool
+ is_bss_section(const Output_section*);
+
// True if we ever saw a SECTIONS clause.
bool saw_sections_clause_;
// True if we are currently processing a SECTIONS clause.