2009-09-02 Tristan Gingold <gingold@adacore.com>
[deliverable/binutils-gdb.git] / gold / defstd.cc
index 50a977a3b9075652440bda0eec00ac4564d3de21..984f3e1b042e44f5b41892ab9fec849d36e0c18d 100644 (file)
@@ -1,8 +1,29 @@
 // defstd.cc -- define standard symbols for gold.
 
+// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of gold.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
 #include "gold.h"
 
 #include "symtab.h"
+#include "layout.h"
 #include "defstd.h"
 
 // This is a simple file which defines the standard symbols like
@@ -152,7 +173,7 @@ const Define_symbol_in_segment in_segment[] =
   {
     "_edata",                  // name
     elfcpp::PT_LOAD,           // segment_type
-    elfcpp::PF_X,              // segment_flags_set
+    elfcpp::PF_W,              // segment_flags_set
     elfcpp::PF(0),             // segment_flags_clear
     0,                         // value
     0,                         // size
@@ -166,7 +187,7 @@ const Define_symbol_in_segment in_segment[] =
   {
     "edata",                   // name
     elfcpp::PT_LOAD,           // segment_type
-    elfcpp::PF_X,              // segment_flags_set
+    elfcpp::PF_W,              // segment_flags_set
     elfcpp::PF(0),             // segment_flags_clear
     0,                         // value
     0,                         // size
@@ -180,7 +201,7 @@ const Define_symbol_in_segment in_segment[] =
   {
     "__bss_start",             // name
     elfcpp::PT_LOAD,           // segment_type
-    elfcpp::PF_X,              // segment_flags_set
+    elfcpp::PF_W,              // segment_flags_set
     elfcpp::PF(0),             // segment_flags_clear
     0,                         // value
     0,                         // size
@@ -194,7 +215,7 @@ const Define_symbol_in_segment in_segment[] =
   {
     "_end",                    // name
     elfcpp::PT_LOAD,           // segment_type
-    elfcpp::PF_X,              // segment_flags_set
+    elfcpp::PF_W,              // segment_flags_set
     elfcpp::PF(0),             // segment_flags_clear
     0,                         // value
     0,                         // size
@@ -202,13 +223,13 @@ const Define_symbol_in_segment in_segment[] =
     elfcpp::STB_GLOBAL,                // binding
     elfcpp::STV_DEFAULT,       // visibility
     0,                         // nonvis
-    Symbol::SEGMENT_START,     // offset_from_base
+    Symbol::SEGMENT_END,       // offset_from_base
     false                      // only_if_ref
   },
   {
     "end",                     // name
     elfcpp::PT_LOAD,           // segment_type
-    elfcpp::PF_X,              // segment_flags_set
+    elfcpp::PF_W,              // segment_flags_set
     elfcpp::PF(0),             // segment_flags_clear
     0,                         // value
     0,                         // size
@@ -216,7 +237,7 @@ const Define_symbol_in_segment in_segment[] =
     elfcpp::STB_GLOBAL,                // binding
     elfcpp::STV_DEFAULT,       // visibility
     0,                         // nonvis
-    Symbol::SEGMENT_START,     // offset_from_base
+    Symbol::SEGMENT_END,       // offset_from_base
     false                      // only_if_ref
   }
 };
@@ -229,11 +250,13 @@ namespace gold
 {
 
 void
-define_standard_symbols(Symbol_table* symtab, const Layout* layout,
-                       Target* target)
+define_standard_symbols(Symbol_table* symtab, const Layout* layout)
 {
-  symtab->define_symbols(layout, target, in_section_count, in_section);
-  symtab->define_symbols(layout, target, in_segment_count, in_segment);
+  bool saw_sections_clause = layout->script_options()->saw_sections_clause();
+  symtab->define_symbols(layout, in_section_count, in_section,
+                        saw_sections_clause);
+  symtab->define_symbols(layout, in_segment_count, in_segment,
+                        saw_sections_clause);
 }
 
 } // End namespace gold.
This page took 0.063115 seconds and 4 git commands to generate.