2010-02-24 Doug Kwan <dougkwan@google.com>
authorDoug Kwan <dougkwan@google.com>
Wed, 24 Feb 2010 20:50:59 +0000 (20:50 +0000)
committerDoug Kwan <dougkwan@google.com>
Wed, 24 Feb 2010 20:50:59 +0000 (20:50 +0000)
* arm.cc (Target_arm::do_finalize_sections): Skip processor specific
flags and attributes merging if an input file is a binary file.
* fileread.cc (Input_file::open): Record format of original file.
* fileread.h (Input_file::Format): New enum type.
    (Input_file::Input_file): Initialize data member format_.
(Input_file::format): New method definition.
(Input_file::format_):: New data member.

gold/ChangeLog
gold/arm.cc
gold/fileread.cc
gold/fileread.h

index a7bf29943ab3734cfe553e33e4ffcce64e45d9f5..92f83448356756894dfeecd174ef8286b052b6b3 100644 (file)
@@ -1,3 +1,13 @@
+2010-02-24  Doug Kwan  <dougkwan@google.com>
+
+       * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
+       flags and attributes merging if an input file is a binary file.
+       * fileread.cc (Input_file::open): Record format of original file.
+       * fileread.h (Input_file::Format): New enum type.
+       (Input_file::Input_file): Initialize data member format_.
+       (Input_file::format): New method definition.
+       (Input_file::format_):: New data member.
+
 2010-02-24  Doug Kwan  <dougkwan@google.com>
 
        * arm.cc (Arm_output_data_got): New class.
index ca34023f435a80efaa47a5cb088239b6f2ab5b3a..497072a8706edd38c7831178823cbcc63747028c 100644 (file)
@@ -7922,6 +7922,15 @@ Target_arm<big_endian>::do_finalize_sections(
        p != input_objects->relobj_end();
        ++p)
     {
+      // If this input file is a binary file, it has no processor
+      // specific flags and attributes section.
+      Input_file::Format format = (*p)->input_file()->format();
+      if (format != Input_file::FORMAT_ELF)
+       {
+         gold_assert(format == Input_file::FORMAT_BINARY);
+         continue;
+       }
+
       Arm_relobj<big_endian>* arm_relobj =
        Arm_relobj<big_endian>::as_arm_relobj(*p);
       this->merge_processor_specific_flags(
index 4e8157f7957c33cfb786ca9b693319e6eaa74774..9f190990a602082d008879d2156bc96424b566de 100644 (file)
@@ -938,17 +938,22 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex)
     this->input_argument_->options().format_enum();
   bool ok;
   if (format == General_options::OBJECT_FORMAT_ELF)
-    ok = this->file_.open(task, name);
+    {
+      ok = this->file_.open(task, name);
+      this->format_ = FORMAT_ELF;
+    }
   else
     {
       gold_assert(format == General_options::OBJECT_FORMAT_BINARY);
       ok = this->open_binary(task, name);
+      this->format_ = FORMAT_BINARY;
     }
 
   if (!ok)
     {
       gold_error(_("cannot open %s: %s"),
                 name.c_str(), strerror(errno));
+      this->format_ = FORMAT_NONE;
       return false;
     }
 
index 5aac7ad62741d17288865225b0d4fd9645b2773d..9933460d5ac534a7ab7e07bbcf5ae03b04108e19 100644 (file)
@@ -464,9 +464,16 @@ class File_view
 class Input_file
 {
  public:
+  enum Format
+  {
+    FORMAT_NONE,
+    FORMAT_ELF,
+    FORMAT_BINARY
+  };
+
   Input_file(const Input_file_argument* input_argument)
     : input_argument_(input_argument), found_name_(), file_(),
-      is_in_sysroot_(false)
+      is_in_sysroot_(false), format_(FORMAT_NONE)
   { }
 
   // Create an input file with the contents already provided.  This is
@@ -536,6 +543,11 @@ class Input_file
   bool
   just_symbols() const;
 
+  // Return the format of the unconverted input file.
+  Format
+  format() const
+  { return this->format_; }
+
  private:
   Input_file(const Input_file&);
   Input_file& operator=(const Input_file&);
@@ -555,6 +567,8 @@ class Input_file
   File_read file_;
   // Whether we found the file in a directory in the system root.
   bool is_in_sysroot_;
+  // Format of unconverted input file.
+  Format format_;
 };
 
 } // end namespace gold
This page took 0.036275 seconds and 4 git commands to generate.