diff options
author | Ian Lance Taylor <iant@google.com> | 2008-02-04 05:43:05 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2008-02-04 05:43:05 +0000 |
commit | a445fddf828b0e8251fbdce91bc9372e7efd24f0 (patch) | |
tree | 6af0ee8254a9432643798126eef663603d92eb08 /gold/script.h | |
parent | d16c732117ed4b752abd51dd1598c9cec9d2b26c (diff) | |
download | gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.zip gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.tar.gz gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.tar.bz2 |
Fully implement the SECTIONS clause.
Diffstat (limited to 'gold/script.h')
-rw-r--r-- | gold/script.h | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/gold/script.h b/gold/script.h index 24bd513..257b479 100644 --- a/gold/script.h +++ b/gold/script.h @@ -46,6 +46,7 @@ class Input_argument; class Input_objects; class Input_group; class Input_file; +class Output_segment; class Task_token; class Workqueue; struct Version_dependency_list; @@ -65,10 +66,27 @@ class Expression virtual ~Expression() { } - // Return the value of the expression. + // Return the value of the expression which is not permitted to + // refer to the dot symbol. uint64_t eval(const Symbol_table*, const Layout*); + // Return the value of an expression which is permitted to refer to + // the dot symbol. This sets *IS_ABSOLUTE to indicate whether this + // is an absolute value; it will be false if a non-absolute symbol + // was referenced in the expression; this is used to detect invalid + // uses when setting a section address. + uint64_t + eval_with_dot(const Symbol_table*, const Layout*, bool dot_has_value, + uint64_t dot_value, bool* is_absolute); + + // Return the value of an expression which may or may not be + // permitted to refer to the dot symbol, depending on + // is_dot_available. + uint64_t + eval_maybe_dot(const Symbol_table*, const Layout*, bool is_dot_available, + bool dot_has_value, uint64_t dot_value, bool* is_absolute); + // Print the expression to the FILE. This is for debugging. virtual void print(FILE*) const = 0; @@ -181,17 +199,35 @@ class Symbol_assignment add_to_table(Symbol_table*); // Finalize the symbol value. - void finalize(Symbol_table*, const Layout*); + void + finalize(Symbol_table*, const Layout*); + + // Finalize the symbol value when it can refer to the dot symbol. + void + finalize_with_dot(Symbol_table*, const Layout*, bool dot_has_value, + uint64_t dot_value); + + // Set the symbol value, but only if the value is absolute. This is + // used while processing a SECTIONS clause. + void + set_if_absolute(Symbol_table*, const Layout*, bool is_dot_available, + bool dot_has_value, uint64_t dot_value); // Print the assignment to the FILE. This is for debugging. void print(FILE*) const; private: + // Shared by finalize and finalize_with_dot. + void + finalize_maybe_dot(Symbol_table*, const Layout*, bool is_dot_available, + bool dot_has_value, uint64_t dot_value); + // Sized version of finalize. template<int size> void - sized_finalize(Symbol_table*, const Layout*); + sized_finalize(Symbol_table*, const Layout*, bool is_dot_available, + bool dot_has_value, uint64_t dot_value); // Symbol name. std::string name_; @@ -274,7 +310,7 @@ class Script_options void add_symbols_to_table(Symbol_table*); - // Finalize the symbol values. + // Finalize the symbol values. Also check assertions. void finalize_symbols(Symbol_table*, const Layout*); @@ -290,6 +326,18 @@ class Script_options script_sections() { return &this->script_sections_; } + // Whether we saw a SECTIONS clause. + bool + saw_sections_clause() const + { return this->script_sections_.saw_sections_clause(); } + + // Set section addresses using a SECTIONS clause. Return the + // segment which should hold the file header and segment headers; + // this may return NULL, in which case the headers are not in a + // loadable segment. + Output_segment* + set_section_addresses(Symbol_table*, Layout*); + // Print the script to the FILE. This is for debugging. void print(FILE*) const; |