Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: gold/layout.cc

Issue 10252012: [MIPS] Initial checkin for MIPS changes for GOLD. (Closed)
Patch Set: Updated MIPS code w/ SH_RELA. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gold/layout.h ('k') | gold/mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gold/layout.cc
===================================================================
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -2543,6 +2543,11 @@
file_header->set_section_info(this->section_headers_, shstrtab_section);
+ // Sets data with values that are only known after sections are finalized.
+ // For MIPS it is needed to set flag if there are more then 0x10000 symbols
+ // in dynamic symbol table.
+ target->fix_sections (this, symtab);
+
// Now we know exactly where everything goes in the output file
// (except for non-allocated sections which require postprocessing).
Output_data::layout_complete();
@@ -2973,12 +2978,32 @@
if (type2 == elfcpp::PT_INTERP)
return false;
+ // This single PT_MIPS_REGINFO segment is required to precede any loadable
+ // segment. We simply make it always third.
+ // TODO AS: Make this only valid for MIPS !!!
+ if (type1 == elfcpp::PT_MIPS_REGINFO)
+ {
+ gold_assert(type2 != elfcpp::PT_MIPS_REGINFO);
+ return true;
+ }
+ if (type2 == elfcpp::PT_MIPS_REGINFO)
+ return false;
+
// We then put PT_LOAD segments before any other segments.
if (type1 == elfcpp::PT_LOAD && type2 != elfcpp::PT_LOAD)
return true;
if (type2 == elfcpp::PT_LOAD && type1 != elfcpp::PT_LOAD)
return false;
+ // MIPS needs PT_NULL segment to be last.
+ if (type1 == elfcpp::PT_NULL)
+ {
+ gold_assert(type2 != elfcpp::PT_NULL);
+ return false;
+ }
+ if (type2 == elfcpp::PT_NULL)
+ return true;
+
// We put the PT_TLS segment last except for the PT_GNU_RELRO
// segment, because that is where the dynamic linker expects to find
// it (this is just for efficiency; other positions would also work
@@ -4509,7 +4534,8 @@
&& parameters->options().shared())
gold_warning(_("shared library text segment is not shareable"));
}
- if (parameters->options().shared() && this->has_static_tls())
+ if ((parameters->options().shared() || parameters->options().pie())
+ && this->has_static_tls())
flags |= elfcpp::DF_STATIC_TLS;
if (parameters->options().origin())
flags |= elfcpp::DF_ORIGIN;
« no previous file with comments | « gold/layout.h ('k') | gold/mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698