symbols before other symbols.
* testsuite/script_test_2.cc (test_addr): Declare.
(test_addr_alias): Declare.
(main): Check that test_addr and test_addr_alias have the right
values.
* testsuite/script_test_2.t: Define test_addr_alias and
test_addr.
+2008-07-29 Ian Lance Taylor <iant@google.com>
+
+ * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
+ symbols before other symbols.
+ * testsuite/script_test_2.cc (test_addr): Declare.
+ (test_addr_alias): Declare.
+ (main): Check that test_addr and test_addr_alias have the right
+ values.
+ * testsuite/script_test_2.t: Define test_addr_alias and
+ test_addr.
+
2008-07-24 Ian Lance Taylor <iant@google.com>
PR 5990
void
Script_options::finalize_symbols(Symbol_table* symtab, const Layout* layout)
{
+ // We finalize the symbols defined in SECTIONS first, because they
+ // are the ones which may have changed. This way if symbol outside
+ // SECTIONS are defined in terms of symbols inside SECTIONS, they
+ // will get the right value.
+ this->script_sections_.finalize_symbols(symtab, layout);
+
for (Symbol_assignments::iterator p = this->symbol_assignments_.begin();
p != this->symbol_assignments_.end();
++p)
p != this->assertions_.end();
++p)
(*p)->check(symtab, layout);
-
- this->script_sections_.finalize_symbols(symtab, layout);
}
// Set section addresses. We set all the symbols which have absolute
extern char start_fill[];
extern char end_fill[];
extern char end_test_area[];
+extern char test_addr[];
+extern char test_addr_alias[];
int
main(int, char**)
assert(end_fill == start_fill + 8);
assert(end_test_area == end_fill);
+
+ assert(test_addr == start_test_area_1);
+ assert(test_addr_alias == test_addr);
}
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+test_addr_alias = test_addr;
+
SECTIONS
{
/* With luck this will work everywhere. */
end_fill = .;
}
end_test_area = .;
+ test_addr = ADDR(.gold_test);
}