aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
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/symtab.cc
parentd16c732117ed4b752abd51dd1598c9cec9d2b26c (diff)
downloadgdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.zip
gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.tar.gz
gdb-a445fddf828b0e8251fbdce91bc9372e7efd24f0.tar.bz2
Fully implement the SECTIONS clause.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc35
1 files changed, 29 insertions, 6 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 78bfec5..288b966 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -298,6 +298,25 @@ Symbol::final_value_is_known() const
return parameters->doing_static_link();
}
+// Return whether the symbol has an absolute value.
+
+bool
+Symbol::value_is_absolute() const
+{
+ switch (this->source_)
+ {
+ case FROM_OBJECT:
+ return this->u_.from_object.shndx == elfcpp::SHN_ABS;
+ case IN_OUTPUT_DATA:
+ case IN_OUTPUT_SEGMENT:
+ return false;
+ case CONSTANT:
+ return true;
+ default:
+ gold_unreachable();
+ }
+}
+
// Class Symbol_table.
Symbol_table::Symbol_table(unsigned int count,
@@ -1336,7 +1355,8 @@ Symbol_table::do_define_as_constant(
void
Symbol_table::define_symbols(const Layout* layout, int count,
- const Define_symbol_in_section* p)
+ const Define_symbol_in_section* p,
+ bool only_if_ref)
{
for (int i = 0; i < count; ++i, ++p)
{
@@ -1345,11 +1365,12 @@ Symbol_table::define_symbols(const Layout* layout, int count,
this->define_in_output_data(p->name, NULL, os, p->value,
p->size, p->type, p->binding,
p->visibility, p->nonvis,
- p->offset_is_from_end, p->only_if_ref);
+ p->offset_is_from_end,
+ only_if_ref || p->only_if_ref);
else
this->define_as_constant(p->name, NULL, 0, p->size, p->type,
p->binding, p->visibility, p->nonvis,
- p->only_if_ref);
+ only_if_ref || p->only_if_ref);
}
}
@@ -1357,7 +1378,8 @@ Symbol_table::define_symbols(const Layout* layout, int count,
void
Symbol_table::define_symbols(const Layout* layout, int count,
- const Define_symbol_in_segment* p)
+ const Define_symbol_in_segment* p,
+ bool only_if_ref)
{
for (int i = 0; i < count; ++i, ++p)
{
@@ -1368,11 +1390,12 @@ Symbol_table::define_symbols(const Layout* layout, int count,
this->define_in_output_segment(p->name, NULL, os, p->value,
p->size, p->type, p->binding,
p->visibility, p->nonvis,
- p->offset_base, p->only_if_ref);
+ p->offset_base,
+ only_if_ref || p->only_if_ref);
else
this->define_as_constant(p->name, NULL, 0, p->size, p->type,
p->binding, p->visibility, p->nonvis,
- p->only_if_ref);
+ only_if_ref || p->only_if_ref);
}
}