OLD | NEW |
1 // output.h -- manage the output file for gold -*- C++ -*- | 1 // output.h -- manage the output file for 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 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 // Record that this is a large section. | 2380 // Record that this is a large section. |
2381 void | 2381 void |
2382 set_is_large_section() | 2382 set_is_large_section() |
2383 { this->is_large_section_ = true; } | 2383 { this->is_large_section_ = true; } |
2384 | 2384 |
2385 // True if this is a large data (not BSS) section. | 2385 // True if this is a large data (not BSS) section. |
2386 bool | 2386 bool |
2387 is_large_data_section() | 2387 is_large_data_section() |
2388 { return this->is_large_section_ && this->type_ != elfcpp::SHT_NOBITS; } | 2388 { return this->is_large_section_ && this->type_ != elfcpp::SHT_NOBITS; } |
2389 | 2389 |
| 2390 // True if this is the .interp section which goes into the PT_INTERP |
| 2391 // segment. |
| 2392 bool |
| 2393 is_interp() const |
| 2394 { return this->is_interp_; } |
| 2395 |
| 2396 // Record that this is the interp section. |
| 2397 void |
| 2398 set_is_interp() |
| 2399 { this->is_interp_ = true; } |
| 2400 |
| 2401 // True if this is a section used by the dynamic linker. |
| 2402 bool |
| 2403 is_dynamic_linker_section() const |
| 2404 { return this->is_dynamic_linker_section_; } |
| 2405 |
| 2406 // Record that this is a section used by the dynamic linker. |
| 2407 void |
| 2408 set_is_dynamic_linker_section() |
| 2409 { this->is_dynamic_linker_section_ = true; } |
| 2410 |
2390 // Return whether this section should be written after all the input | 2411 // Return whether this section should be written after all the input |
2391 // sections are complete. | 2412 // sections are complete. |
2392 bool | 2413 bool |
2393 after_input_sections() const | 2414 after_input_sections() const |
2394 { return this->after_input_sections_; } | 2415 { return this->after_input_sections_; } |
2395 | 2416 |
2396 // Record that this section should be written after all the input | 2417 // Record that this section should be written after all the input |
2397 // sections are complete. | 2418 // sections are complete. |
2398 void | 2419 void |
2399 set_after_input_sections() | 2420 set_after_input_sections() |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 // already been sorted. | 3341 // already been sorted. |
3321 bool attached_input_sections_are_sorted_ : 1; | 3342 bool attached_input_sections_are_sorted_ : 1; |
3322 // True if this section holds relro data. | 3343 // True if this section holds relro data. |
3323 bool is_relro_ : 1; | 3344 bool is_relro_ : 1; |
3324 // True if this section holds relro local data. | 3345 // True if this section holds relro local data. |
3325 bool is_relro_local_ : 1; | 3346 bool is_relro_local_ : 1; |
3326 // True if this is a small section. | 3347 // True if this is a small section. |
3327 bool is_small_section_ : 1; | 3348 bool is_small_section_ : 1; |
3328 // True if this is a large section. | 3349 // True if this is a large section. |
3329 bool is_large_section_ : 1; | 3350 bool is_large_section_ : 1; |
| 3351 // True if this is the .interp section going into the PT_INTERP |
| 3352 // segment. |
| 3353 bool is_interp_ : 1; |
| 3354 // True if this is section is read by the dynamic linker. |
| 3355 bool is_dynamic_linker_section_ : 1; |
| 3356 // Whether code-fills are generated at write. |
| 3357 bool generate_code_fills_at_write_ : 1; |
3330 // For SHT_TLS sections, the offset of this section relative to the base | 3358 // For SHT_TLS sections, the offset of this section relative to the base |
3331 // of the TLS segment. | 3359 // of the TLS segment. |
3332 uint64_t tls_offset_; | 3360 uint64_t tls_offset_; |
3333 // Saved checkpoint. | 3361 // Saved checkpoint. |
3334 Checkpoint_output_section* checkpoint_; | 3362 Checkpoint_output_section* checkpoint_; |
3335 // Map from input sections to merge sections. | 3363 // Map from input sections to merge sections. |
3336 Output_section_data_by_input_section_map merge_section_map_; | 3364 Output_section_data_by_input_section_map merge_section_map_; |
3337 // Map from merge section properties to merge_sections; | 3365 // Map from merge section properties to merge_sections; |
3338 Merge_section_by_properties_map merge_section_by_properties_map_; | 3366 Merge_section_by_properties_map merge_section_by_properties_map_; |
3339 // Map from input sections to relaxed input sections. This is mutable | 3367 // Map from input sections to relaxed input sections. This is mutable |
3340 // beacause it is udpated lazily. We may need to update it in a | 3368 // because it is updated lazily. We may need to update it in a |
3341 // const qualified method. | 3369 // const qualified method. |
3342 mutable Output_section_data_by_input_section_map relaxed_input_section_map_; | 3370 mutable Output_section_data_by_input_section_map relaxed_input_section_map_; |
3343 // Whether relaxed_input_section_map_ is valid. | 3371 // Whether relaxed_input_section_map_ is valid. |
3344 mutable bool is_relaxed_input_section_map_valid_; | 3372 mutable bool is_relaxed_input_section_map_valid_; |
3345 // Whether code-fills are generated at write. | |
3346 bool generate_code_fills_at_write_; | |
3347 }; | 3373 }; |
3348 | 3374 |
3349 // An output segment. PT_LOAD segments are built from collections of | 3375 // An output segment. PT_LOAD segments are built from collections of |
3350 // output sections. Other segments typically point within PT_LOAD | 3376 // output sections. Other segments typically point within PT_LOAD |
3351 // segments, and are built directly as needed. | 3377 // segments, and are built directly as needed. |
3352 // | 3378 // |
3353 // NOTE: We want to use the copy constructor for this class. During | 3379 // NOTE: We want to use the copy constructor for this class. During |
3354 // relaxation, we may try built the segments multiple times. We do | 3380 // relaxation, we may try built the segments multiple times. We do |
3355 // that by copying the original segment list before lay-out, doing | 3381 // that by copying the original segment list before lay-out, doing |
3356 // a trial lay-out and roll-back to the saved copied if we need to | 3382 // a trial lay-out and roll-back to the saved copied if we need to |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3405 // Record that this is a segment created to hold large data | 3431 // Record that this is a segment created to hold large data |
3406 // sections. | 3432 // sections. |
3407 void | 3433 void |
3408 set_is_large_data_segment() | 3434 set_is_large_data_segment() |
3409 { this->is_large_data_segment_ = true; } | 3435 { this->is_large_data_segment_ = true; } |
3410 | 3436 |
3411 // Return the maximum alignment of the Output_data. | 3437 // Return the maximum alignment of the Output_data. |
3412 uint64_t | 3438 uint64_t |
3413 maximum_alignment(); | 3439 maximum_alignment(); |
3414 | 3440 |
3415 // Add an Output_section to this segment. | 3441 // Add the Output_section OS to this segment. SEG_FLAGS is the |
| 3442 // segment flags to use. DO_SORT is true if we should sort the |
| 3443 // placement of the input section for more efficient generated code. |
3416 void | 3444 void |
3417 add_output_section(Output_section* os, elfcpp::Elf_Word seg_flags); | 3445 add_output_section(Output_section* os, elfcpp::Elf_Word seg_flags, |
| 3446 » » bool do_sort); |
3418 | 3447 |
3419 // Remove an Output_section from this segment. It is an error if it | 3448 // Remove an Output_section from this segment. It is an error if it |
3420 // is not present. | 3449 // is not present. |
3421 void | 3450 void |
3422 remove_output_section(Output_section* os); | 3451 remove_output_section(Output_section* os); |
3423 | 3452 |
3424 // Add an Output_data (which is not an Output_section) to the start | 3453 // Add an Output_data (which is not an Output_section) to the start |
3425 // of this segment. | 3454 // of this segment. |
3426 void | 3455 void |
3427 add_initial_output_data(Output_data*); | 3456 add_initial_output_data(Output_data*); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3707 unsigned char* base_; | 3736 unsigned char* base_; |
3708 // True iff base_ points to a memory buffer rather than an output file. | 3737 // True iff base_ points to a memory buffer rather than an output file. |
3709 bool map_is_anonymous_; | 3738 bool map_is_anonymous_; |
3710 // True if this is a temporary file which should not be output. | 3739 // True if this is a temporary file which should not be output. |
3711 bool is_temporary_; | 3740 bool is_temporary_; |
3712 }; | 3741 }; |
3713 | 3742 |
3714 } // End namespace gold. | 3743 } // End namespace gold. |
3715 | 3744 |
3716 #endif // !defined(GOLD_OUTPUT_H) | 3745 #endif // !defined(GOLD_OUTPUT_H) |
OLD | NEW |