OLD | NEW |
1 // symtab.cc -- the gold symbol table | 1 // symtab.cc -- the gold symbol table |
2 | 2 |
3 // Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | 3 // Copyright 2006, 2007, 2008, 2009 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 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 else if (!sym->has_dynsym_index()) | 2235 else if (!sym->has_dynsym_index()) |
2236 { | 2236 { |
2237 sym->set_dynsym_index(index); | 2237 sym->set_dynsym_index(index); |
2238 ++index; | 2238 ++index; |
2239 syms->push_back(sym); | 2239 syms->push_back(sym); |
2240 dynpool->add(sym->name(), false, NULL); | 2240 dynpool->add(sym->name(), false, NULL); |
2241 | 2241 |
2242 // Record any version information. | 2242 // Record any version information. |
2243 if (sym->version() != NULL) | 2243 if (sym->version() != NULL) |
2244 versions->record_version(this, dynpool, sym); | 2244 versions->record_version(this, dynpool, sym); |
| 2245 |
| 2246 // If the symbol is defined in a dynamic object and is |
| 2247 // referenced in a regular object, then mark the dynamic |
| 2248 // object as needed. This is used to implement --as-needed. |
| 2249 if (sym->is_from_dynobj() && sym->in_reg()) |
| 2250 sym->object()->set_is_needed(); |
2245 } | 2251 } |
2246 } | 2252 } |
2247 | 2253 |
2248 // Finish up the versions. In some cases this may add new dynamic | 2254 // Finish up the versions. In some cases this may add new dynamic |
2249 // symbols. | 2255 // symbols. |
2250 index = versions->finalize(this, index, syms); | 2256 index = versions->finalize(this, index, syms); |
2251 | 2257 |
2252 return index; | 2258 return index; |
2253 } | 2259 } |
2254 | 2260 |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3278 | 3284 |
3279 #ifdef HAVE_TARGET_64_BIG | 3285 #ifdef HAVE_TARGET_64_BIG |
3280 template | 3286 template |
3281 void | 3287 void |
3282 Warnings::issue_warning<64, true>(const Symbol* sym, | 3288 Warnings::issue_warning<64, true>(const Symbol* sym, |
3283 const Relocate_info<64, true>* relinfo, | 3289 const Relocate_info<64, true>* relinfo, |
3284 size_t relnum, off_t reloffset) const; | 3290 size_t relnum, off_t reloffset) const; |
3285 #endif | 3291 #endif |
3286 | 3292 |
3287 } // End namespace gold. | 3293 } // End namespace gold. |
OLD | NEW |