OLD | NEW |
1 // copy-relocs.cc -- handle COPY relocations for gold. | 1 // copy-relocs.cc -- handle COPY relocations for gold. |
2 | 2 |
3 // Copyright 2006, 2007, 2008 Free Software Foundation, Inc. | 3 // Copyright 2006, 2007, 2008, 2009, 2010 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 |
11 // (at your option) any later version. | 11 // (at your option) any later version. |
12 | 12 |
13 // This program is distributed in the hope that it will be useful, | 13 // This program is distributed in the hope that it will be useful, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 bool is_ordinary; | 125 bool is_ordinary; |
126 unsigned int shndx = sym->shndx(&is_ordinary); | 126 unsigned int shndx = sym->shndx(&is_ordinary); |
127 gold_assert(is_ordinary); | 127 gold_assert(is_ordinary); |
128 typename elfcpp::Elf_types<size>::Elf_WXword addralign = | 128 typename elfcpp::Elf_types<size>::Elf_WXword addralign = |
129 sym->object()->section_addralign(shndx); | 129 sym->object()->section_addralign(shndx); |
130 | 130 |
131 typename Sized_symbol<size>::Value_type value = sym->value(); | 131 typename Sized_symbol<size>::Value_type value = sym->value(); |
132 while ((value & (addralign - 1)) != 0) | 132 while ((value & (addralign - 1)) != 0) |
133 addralign >>= 1; | 133 addralign >>= 1; |
134 | 134 |
| 135 // Mark the dynamic object as needed for the --as-needed option. |
| 136 sym->object()->set_is_needed(); |
| 137 |
135 if (this->dynbss_ == NULL) | 138 if (this->dynbss_ == NULL) |
136 { | 139 { |
137 this->dynbss_ = new Output_data_space(addralign, "** dynbss"); | 140 this->dynbss_ = new Output_data_space(addralign, "** dynbss"); |
138 layout->add_output_section_data(".bss", | 141 layout->add_output_section_data(".bss", |
139 elfcpp::SHT_NOBITS, | 142 elfcpp::SHT_NOBITS, |
140 elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE, | 143 elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE, |
141 » » » » this->dynbss_); | 144 » » » » this->dynbss_, false); |
142 } | 145 } |
143 | 146 |
144 Output_data_space* dynbss = this->dynbss_; | 147 Output_data_space* dynbss = this->dynbss_; |
145 | 148 |
146 if (addralign > dynbss->addralign()) | 149 if (addralign > dynbss->addralign()) |
147 dynbss->set_space_alignment(addralign); | 150 dynbss->set_space_alignment(addralign); |
148 | 151 |
149 section_size_type dynbss_size = | 152 section_size_type dynbss_size = |
150 convert_to_section_size_type(dynbss->current_data_size()); | 153 convert_to_section_size_type(dynbss->current_data_size()); |
151 dynbss_size = align_address(dynbss_size, addralign); | 154 dynbss_size = align_address(dynbss_size, addralign); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 238 |
236 #ifdef HAVE_TARGET_64_BIG | 239 #ifdef HAVE_TARGET_64_BIG |
237 template | 240 template |
238 class Copy_relocs<elfcpp::SHT_REL, 64, true>; | 241 class Copy_relocs<elfcpp::SHT_REL, 64, true>; |
239 | 242 |
240 template | 243 template |
241 class Copy_relocs<elfcpp::SHT_RELA, 64, true>; | 244 class Copy_relocs<elfcpp::SHT_RELA, 64, true>; |
242 #endif | 245 #endif |
243 | 246 |
244 } // End namespace gold. | 247 } // End namespace gold. |
OLD | NEW |