| OLD | NEW |
| 1 // script-sections.cc -- linker script SECTIONS for gold | 1 // script-sections.cc -- linker script SECTIONS for gold |
| 2 | 2 |
| 3 // Copyright 2008, 2009 Free Software Foundation, Inc. | 3 // Copyright 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 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 if (need_new_segment) | 3044 if (need_new_segment) |
| 3045 { | 3045 { |
| 3046 current_seg = layout->make_output_segment(elfcpp::PT_LOAD, | 3046 current_seg = layout->make_output_segment(elfcpp::PT_LOAD, |
| 3047 seg_flags); | 3047 seg_flags); |
| 3048 current_seg->set_addresses(vma, lma); | 3048 current_seg->set_addresses(vma, lma); |
| 3049 if (first_seg == NULL) | 3049 if (first_seg == NULL) |
| 3050 first_seg = current_seg; | 3050 first_seg = current_seg; |
| 3051 is_current_seg_readonly = true; | 3051 is_current_seg_readonly = true; |
| 3052 } | 3052 } |
| 3053 | 3053 |
| 3054 current_seg->add_output_section(*p, seg_flags); | 3054 current_seg->add_output_section(*p, seg_flags, false); |
| 3055 | 3055 |
| 3056 if (((*p)->flags() & elfcpp::SHF_WRITE) != 0) | 3056 if (((*p)->flags() & elfcpp::SHF_WRITE) != 0) |
| 3057 is_current_seg_readonly = false; | 3057 is_current_seg_readonly = false; |
| 3058 | 3058 |
| 3059 plast = p; | 3059 plast = p; |
| 3060 last_vma = vma; | 3060 last_vma = vma; |
| 3061 last_lma = lma; | 3061 last_lma = lma; |
| 3062 last_size = size; | 3062 last_size = size; |
| 3063 } | 3063 } |
| 3064 | 3064 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 for (Layout::Section_list::const_iterator p = sections->begin(); | 3123 for (Layout::Section_list::const_iterator p = sections->begin(); |
| 3124 p != sections->end(); | 3124 p != sections->end(); |
| 3125 ++p) | 3125 ++p) |
| 3126 { | 3126 { |
| 3127 if ((*p)->type() == elfcpp::SHT_NOTE) | 3127 if ((*p)->type() == elfcpp::SHT_NOTE) |
| 3128 { | 3128 { |
| 3129 elfcpp::Elf_Word seg_flags = | 3129 elfcpp::Elf_Word seg_flags = |
| 3130 Layout::section_flags_to_segment((*p)->flags()); | 3130 Layout::section_flags_to_segment((*p)->flags()); |
| 3131 Output_segment* oseg = layout->make_output_segment(elfcpp::PT_NOTE, | 3131 Output_segment* oseg = layout->make_output_segment(elfcpp::PT_NOTE, |
| 3132 seg_flags); | 3132 seg_flags); |
| 3133 » oseg->add_output_section(*p, seg_flags); | 3133 » oseg->add_output_section(*p, seg_flags, false); |
| 3134 | 3134 |
| 3135 // Incorporate any subsequent SHT_NOTE sections, in the | 3135 // Incorporate any subsequent SHT_NOTE sections, in the |
| 3136 // hopes that the script is sensible. | 3136 // hopes that the script is sensible. |
| 3137 Layout::Section_list::const_iterator pnext = p + 1; | 3137 Layout::Section_list::const_iterator pnext = p + 1; |
| 3138 while (pnext != sections->end() | 3138 while (pnext != sections->end() |
| 3139 && (*pnext)->type() == elfcpp::SHT_NOTE) | 3139 && (*pnext)->type() == elfcpp::SHT_NOTE) |
| 3140 { | 3140 { |
| 3141 seg_flags = Layout::section_flags_to_segment((*pnext)->flags()); | 3141 seg_flags = Layout::section_flags_to_segment((*pnext)->flags()); |
| 3142 » oseg->add_output_section(*pnext, seg_flags); | 3142 » oseg->add_output_section(*pnext, seg_flags, false); |
| 3143 p = pnext; | 3143 p = pnext; |
| 3144 ++pnext; | 3144 ++pnext; |
| 3145 } | 3145 } |
| 3146 } | 3146 } |
| 3147 | 3147 |
| 3148 if (((*p)->flags() & elfcpp::SHF_TLS) != 0) | 3148 if (((*p)->flags() & elfcpp::SHF_TLS) != 0) |
| 3149 { | 3149 { |
| 3150 if (saw_tls) | 3150 if (saw_tls) |
| 3151 gold_error(_("TLS sections are not adjacent")); | 3151 gold_error(_("TLS sections are not adjacent")); |
| 3152 | 3152 |
| 3153 elfcpp::Elf_Word seg_flags = | 3153 elfcpp::Elf_Word seg_flags = |
| 3154 Layout::section_flags_to_segment((*p)->flags()); | 3154 Layout::section_flags_to_segment((*p)->flags()); |
| 3155 Output_segment* oseg = layout->make_output_segment(elfcpp::PT_TLS, | 3155 Output_segment* oseg = layout->make_output_segment(elfcpp::PT_TLS, |
| 3156 seg_flags); | 3156 seg_flags); |
| 3157 » oseg->add_output_section(*p, seg_flags); | 3157 » oseg->add_output_section(*p, seg_flags, false); |
| 3158 | 3158 |
| 3159 Layout::Section_list::const_iterator pnext = p + 1; | 3159 Layout::Section_list::const_iterator pnext = p + 1; |
| 3160 while (pnext != sections->end() | 3160 while (pnext != sections->end() |
| 3161 && ((*pnext)->flags() & elfcpp::SHF_TLS) != 0) | 3161 && ((*pnext)->flags() & elfcpp::SHF_TLS) != 0) |
| 3162 { | 3162 { |
| 3163 seg_flags = Layout::section_flags_to_segment((*pnext)->flags()); | 3163 seg_flags = Layout::section_flags_to_segment((*pnext)->flags()); |
| 3164 » oseg->add_output_section(*pnext, seg_flags); | 3164 » oseg->add_output_section(*pnext, seg_flags, false); |
| 3165 p = pnext; | 3165 p = pnext; |
| 3166 ++pnext; | 3166 ++pnext; |
| 3167 } | 3167 } |
| 3168 | 3168 |
| 3169 saw_tls = true; | 3169 saw_tls = true; |
| 3170 } | 3170 } |
| 3171 } | 3171 } |
| 3172 } | 3172 } |
| 3173 | 3173 |
| 3174 // Add a program header. The PHDRS clause is syntactically distinct | 3174 // Add a program header. The PHDRS clause is syntactically distinct |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3308 if (r == name_to_segment.end()) | 3308 if (r == name_to_segment.end()) |
| 3309 gold_error(_("no segment %s"), q->c_str()); | 3309 gold_error(_("no segment %s"), q->c_str()); |
| 3310 else | 3310 else |
| 3311 { | 3311 { |
| 3312 if (load_segments_only | 3312 if (load_segments_only |
| 3313 && r->second->type() != elfcpp::PT_LOAD) | 3313 && r->second->type() != elfcpp::PT_LOAD) |
| 3314 continue; | 3314 continue; |
| 3315 | 3315 |
| 3316 elfcpp::Elf_Word seg_flags = | 3316 elfcpp::Elf_Word seg_flags = |
| 3317 Layout::section_flags_to_segment(os->flags()); | 3317 Layout::section_flags_to_segment(os->flags()); |
| 3318 » r->second->add_output_section(os, seg_flags); | 3318 » r->second->add_output_section(os, seg_flags, false); |
| 3319 | 3319 |
| 3320 if (r->second->type() == elfcpp::PT_LOAD) | 3320 if (r->second->type() == elfcpp::PT_LOAD) |
| 3321 { | 3321 { |
| 3322 if (in_load_segment) | 3322 if (in_load_segment) |
| 3323 gold_error(_("section in two PT_LOAD segments")); | 3323 gold_error(_("section in two PT_LOAD segments")); |
| 3324 in_load_segment = true; | 3324 in_load_segment = true; |
| 3325 } | 3325 } |
| 3326 } | 3326 } |
| 3327 } | 3327 } |
| 3328 | 3328 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3504 fprintf(f, "PHDRS {\n"); | 3504 fprintf(f, "PHDRS {\n"); |
| 3505 for (Phdrs_elements::const_iterator p = this->phdrs_elements_->begin(); | 3505 for (Phdrs_elements::const_iterator p = this->phdrs_elements_->begin(); |
| 3506 p != this->phdrs_elements_->end(); | 3506 p != this->phdrs_elements_->end(); |
| 3507 ++p) | 3507 ++p) |
| 3508 (*p)->print(f); | 3508 (*p)->print(f); |
| 3509 fprintf(f, "}\n"); | 3509 fprintf(f, "}\n"); |
| 3510 } | 3510 } |
| 3511 } | 3511 } |
| 3512 | 3512 |
| 3513 } // End namespace gold. | 3513 } // End namespace gold. |
| OLD | NEW |