| OLD | NEW |
| 1 // object.h -- support for an object file for linking in gold -*- C++ -*- | 1 // object.h -- support for an object file for linking in gold -*- C++ -*- |
| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 class Object | 188 class Object |
| 189 { | 189 { |
| 190 public: | 190 public: |
| 191 // NAME is the name of the object as we would report it to the user | 191 // NAME is the name of the object as we would report it to the user |
| 192 // (e.g., libfoo.a(bar.o) if this is in an archive. INPUT_FILE is | 192 // (e.g., libfoo.a(bar.o) if this is in an archive. INPUT_FILE is |
| 193 // used to read the file. OFFSET is the offset within the input | 193 // used to read the file. OFFSET is the offset within the input |
| 194 // file--0 for a .o or .so file, something else for a .a file. | 194 // file--0 for a .o or .so file, something else for a .a file. |
| 195 Object(const std::string& name, Input_file* input_file, bool is_dynamic, | 195 Object(const std::string& name, Input_file* input_file, bool is_dynamic, |
| 196 off_t offset = 0) | 196 off_t offset = 0) |
| 197 : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U), | 197 : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U), |
| 198 is_dynamic_(is_dynamic), uses_split_stack_(false), | 198 is_dynamic_(is_dynamic), is_needed_(false), uses_split_stack_(false), |
| 199 has_no_split_stack_(false), xindex_(NULL), no_export_(false) | 199 has_no_split_stack_(false), no_export_(false), xindex_(NULL) |
| 200 { input_file->file().add_object(); } | 200 { input_file->file().add_object(); } |
| 201 | 201 |
| 202 virtual ~Object() | 202 virtual ~Object() |
| 203 { this->input_file_->file().remove_object(); } | 203 { this->input_file_->file().remove_object(); } |
| 204 | 204 |
| 205 // Return the name of the object as we would report it to the tuser. | 205 // Return the name of the object as we would report it to the tuser. |
| 206 const std::string& | 206 const std::string& |
| 207 name() const | 207 name() const |
| 208 { return this->name_; } | 208 { return this->name_; } |
| 209 | 209 |
| 210 // Get the offset into the file. | 210 // Get the offset into the file. |
| 211 off_t | 211 off_t |
| 212 offset() const | 212 offset() const |
| 213 { return this->offset_; } | 213 { return this->offset_; } |
| 214 | 214 |
| 215 // Return whether this is a dynamic object. | 215 // Return whether this is a dynamic object. |
| 216 bool | 216 bool |
| 217 is_dynamic() const | 217 is_dynamic() const |
| 218 { return this->is_dynamic_; } | 218 { return this->is_dynamic_; } |
| 219 | 219 |
| 220 // Return whether this object is needed--true if it is a dynamic |
| 221 // object which defines some symbol referenced by a regular object. |
| 222 // We keep the flag here rather than in Dynobj for convenience when |
| 223 // setting it. |
| 224 bool |
| 225 is_needed() const |
| 226 { return this->is_needed_; } |
| 227 |
| 228 // Record that this object is needed. |
| 229 void |
| 230 set_is_needed() |
| 231 { this->is_needed_ = true; } |
| 232 |
| 220 // Return whether this object was compiled with -fsplit-stack. | 233 // Return whether this object was compiled with -fsplit-stack. |
| 221 bool | 234 bool |
| 222 uses_split_stack() const | 235 uses_split_stack() const |
| 223 { return this->uses_split_stack_; } | 236 { return this->uses_split_stack_; } |
| 224 | 237 |
| 225 // Return whether this object contains any functions compiled with | 238 // Return whether this object contains any functions compiled with |
| 226 // the no_split_stack attribute. | 239 // the no_split_stack attribute. |
| 227 bool | 240 bool |
| 228 has_no_split_stack() const | 241 has_no_split_stack() const |
| 229 { return this->has_no_split_stack_; } | 242 { return this->has_no_split_stack_; } |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // Name of object as printed to user. | 595 // Name of object as printed to user. |
| 583 std::string name_; | 596 std::string name_; |
| 584 // For reading the file. | 597 // For reading the file. |
| 585 Input_file* input_file_; | 598 Input_file* input_file_; |
| 586 // Offset within the file--0 for an object file, non-0 for an | 599 // Offset within the file--0 for an object file, non-0 for an |
| 587 // archive. | 600 // archive. |
| 588 off_t offset_; | 601 off_t offset_; |
| 589 // Number of input sections. | 602 // Number of input sections. |
| 590 unsigned int shnum_; | 603 unsigned int shnum_; |
| 591 // Whether this is a dynamic object. | 604 // Whether this is a dynamic object. |
| 592 bool is_dynamic_; | 605 bool is_dynamic_ : 1; |
| 606 // Whether this object is needed. This is only set for dynamic |
| 607 // objects, and means that the object defined a symbol which was |
| 608 // used by a reference from a regular object. |
| 609 bool is_needed_ : 1; |
| 593 // Whether this object was compiled with -fsplit-stack. | 610 // Whether this object was compiled with -fsplit-stack. |
| 594 bool uses_split_stack_; | 611 bool uses_split_stack_ : 1; |
| 595 // Whether this object contains any functions compiled with the | 612 // Whether this object contains any functions compiled with the |
| 596 // no_split_stack attribute. | 613 // no_split_stack attribute. |
| 597 bool has_no_split_stack_; | 614 bool has_no_split_stack_ : 1; |
| 615 // True if exclude this object from automatic symbol export. |
| 616 // This is used only for archive objects. |
| 617 bool no_export_ : 1; |
| 598 // Many sections for objects with more than SHN_LORESERVE sections. | 618 // Many sections for objects with more than SHN_LORESERVE sections. |
| 599 Xindex* xindex_; | 619 Xindex* xindex_; |
| 600 // True if exclude this object from automatic symbol export. | |
| 601 // This is used only for archive objects. | |
| 602 bool no_export_; | |
| 603 }; | 620 }; |
| 604 | 621 |
| 605 // A regular object (ET_REL). This is an abstract base class itself. | 622 // A regular object (ET_REL). This is an abstract base class itself. |
| 606 // The implementation is the template class Sized_relobj. | 623 // The implementation is the template class Sized_relobj. |
| 607 | 624 |
| 608 class Relobj : public Object | 625 class Relobj : public Object |
| 609 { | 626 { |
| 610 public: | 627 public: |
| 611 Relobj(const std::string& name, Input_file* input_file, off_t offset = 0) | 628 Relobj(const std::string& name, Input_file* input_file, off_t offset = 0) |
| 612 : Object(name, input_file, false, offset), | 629 : Object(name, input_file, false, offset), |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2035 // error message. | 2052 // error message. |
| 2036 | 2053 |
| 2037 extern Object* | 2054 extern Object* |
| 2038 make_elf_object(const std::string& name, Input_file*, | 2055 make_elf_object(const std::string& name, Input_file*, |
| 2039 off_t offset, const unsigned char* p, | 2056 off_t offset, const unsigned char* p, |
| 2040 section_offset_type bytes, bool* punconfigured); | 2057 section_offset_type bytes, bool* punconfigured); |
| 2041 | 2058 |
| 2042 } // end namespace gold | 2059 } // end namespace gold |
| 2043 | 2060 |
| 2044 #endif // !defined(GOLD_OBJECT_H) | 2061 #endif // !defined(GOLD_OBJECT_H) |
| OLD | NEW |