Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // output.cc -- manage the output file for gold | 1 // output.cc -- manage the output file for gold |
| 2 | 2 |
| 3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | 3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
| 4 // Written by Ian Lance Taylor <iant@google.com>. | 4 // Written by Ian Lance Taylor <iant@google.com>. |
| 5 | 5 |
| 6 // This file is part of gold. | 6 // This file is part of gold. |
| 7 | 7 |
| 8 // This program is free software; you can redistribute it and/or modify | 8 // This program is free software; you can redistribute it and/or modify |
| 9 // it under the terms of the GNU General Public License as published by | 9 // it under the terms of the GNU General Public License as published by |
| 10 // the Free Software Foundation; either version 3 of the License, or | 10 // the Free Software Foundation; either version 3 of the License, or |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 else | 601 else |
| 602 { | 602 { |
| 603 // We couldn't find the entry symbol. See if we can parse it as | 603 // We couldn't find the entry symbol. See if we can parse it as |
| 604 // a number. This supports, e.g., -e 0x1000. | 604 // a number. This supports, e.g., -e 0x1000. |
| 605 char* endptr; | 605 char* endptr; |
| 606 v = strtoull(entry, &endptr, 0); | 606 v = strtoull(entry, &endptr, 0); |
| 607 if (*endptr != '\0') | 607 if (*endptr != '\0') |
| 608 { | 608 { |
| 609 if (should_issue_warning) | 609 if (should_issue_warning) |
| 610 gold_warning("cannot find entry symbol '%s'", entry); | 610 gold_warning("cannot find entry symbol '%s'", entry); |
| 611 » v = 0; | 611 |
| 612 » // Can't find the entry symbol, and it's not a number. Use | |
|
robertm
2012/04/27 19:46:15
This wont help with pnacl, wouldn't it be cleaner
Aleksandar Simeonov
2012/05/08 15:21:42
MIPS port of Gold is made to work the same way as
| |
| 613 » // the first address in the text section. | |
| 614 » v = this->target_->text_section_address(); | |
| 612 } | 615 } |
| 613 } | 616 } |
| 614 | 617 |
| 615 return v; | 618 return v; |
| 616 } | 619 } |
| 617 | 620 |
| 618 // Compute the current data size. | 621 // Compute the current data size. |
| 619 | 622 |
| 620 off_t | 623 off_t |
| 621 Output_file_header::do_size() const | 624 Output_file_header::do_size() const |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 // to the front. Among relative relocs, we sort by output address. | 1148 // to the front. Among relative relocs, we sort by output address. |
| 1146 // Among non-relative relocs, we sort by symbol index, then by output | 1149 // Among non-relative relocs, we sort by symbol index, then by output |
| 1147 // address. | 1150 // address. |
| 1148 | 1151 |
| 1149 template<bool dynamic, int size, bool big_endian> | 1152 template<bool dynamic, int size, bool big_endian> |
| 1150 int | 1153 int |
| 1151 Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>:: | 1154 Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>:: |
| 1152 compare(const Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>& r2) | 1155 compare(const Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>& r2) |
| 1153 const | 1156 const |
| 1154 { | 1157 { |
| 1158 // R_MIPS_NONE relocation have to be first. | |
|
robertm
2012/04/27 19:46:15
why ? add comment
Aleksandar Simeonov
2012/05/08 15:21:42
On IRIX n64 rtld would ignore all dynamic relocati
| |
| 1159 if(this->type_ == 0) | |
| 1160 return -1; | |
| 1161 else if(r2.type_ == 0) | |
| 1162 return 1; | |
| 1163 | |
| 1155 if (this->is_relative_) | 1164 if (this->is_relative_) |
| 1156 { | 1165 { |
| 1157 if (!r2.is_relative_) | 1166 if (!r2.is_relative_) |
| 1158 return -1; | 1167 return -1; |
| 1159 // Otherwise sort by reloc address below. | 1168 // Otherwise sort by reloc address below. |
| 1160 } | 1169 } |
| 1161 else if (r2.is_relative_) | 1170 else if (r2.is_relative_) |
| 1162 return 1; | 1171 return 1; |
| 1163 else | 1172 else |
| 1164 { | 1173 { |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1716 const Sized_symbol<size>* s = | 1725 const Sized_symbol<size>* s = |
| 1717 static_cast<const Sized_symbol<size>*>(this->u_.sym); | 1726 static_cast<const Sized_symbol<size>*>(this->u_.sym); |
| 1718 val = s->value(); | 1727 val = s->value(); |
| 1719 } | 1728 } |
| 1720 break; | 1729 break; |
| 1721 | 1730 |
| 1722 case DYNAMIC_STRING: | 1731 case DYNAMIC_STRING: |
| 1723 val = pool->get_offset(this->u_.str); | 1732 val = pool->get_offset(this->u_.str); |
| 1724 break; | 1733 break; |
| 1725 | 1734 |
| 1735 case DYNAMIC_TARGET: | |
| 1736 val = parameters->target().dynamic_tag_value(this->tag_); | |
| 1737 break; | |
| 1738 | |
| 1726 default: | 1739 default: |
| 1727 val = this->u_.od->address() + this->offset_; | 1740 val = this->u_.od->address() + this->offset_; |
| 1728 break; | 1741 break; |
| 1729 } | 1742 } |
| 1730 | 1743 |
| 1731 elfcpp::Dyn_write<size, big_endian> dw(pov); | 1744 elfcpp::Dyn_write<size, big_endian> dw(pov); |
| 1732 dw.put_d_tag(this->tag_); | 1745 dw.put_d_tag(this->tag_); |
| 1733 dw.put_d_val(val); | 1746 dw.put_d_val(val); |
| 1734 } | 1747 } |
| 1735 | 1748 |
| (...skipping 3676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5412 template | 5425 template |
| 5413 class Output_data_got<64, false>; | 5426 class Output_data_got<64, false>; |
| 5414 #endif | 5427 #endif |
| 5415 | 5428 |
| 5416 #ifdef HAVE_TARGET_64_BIG | 5429 #ifdef HAVE_TARGET_64_BIG |
| 5417 template | 5430 template |
| 5418 class Output_data_got<64, true>; | 5431 class Output_data_got<64, true>; |
| 5419 #endif | 5432 #endif |
| 5420 | 5433 |
| 5421 } // End namespace gold. | 5434 } // End namespace gold. |
| OLD | NEW |