public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Add NaCl support to gold for Mips
@ 2014-08-20 13:37 Sasa Stankovic
  2014-09-02 16:44 ` Cary Coutant
  0 siblings, 1 reply; 4+ messages in thread
From: Sasa Stankovic @ 2014-08-20 13:37 UTC (permalink / raw)
  To: Cary Coutant [ccoutant@google.com]; +Cc: binutils, Petar Jovanovic

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

Added subject this time.

Hi Cary,

The attached patch adds NaCl (NativeClient) specific classes Target_mips_nacl and Target_selector_mips_nacl, and initializes Target_mips_nacl's Target_info structure with NaCl's specific data, similar to how it's implemented for arm, i386 and x86_64.

Regards,
Sasa

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mips-nacl.patch --]
[-- Type: text/x-patch; name="mips-nacl.patch", Size: 3977 bytes --]

diff --git a/gold/mips.cc b/gold/mips.cc
index 450883e..92e1201 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -44,6 +44,7 @@
 #include "tls.h"
 #include "errors.h"
 #include "gc.h"
+#include "nacl.h"
 
 namespace
 {
@@ -3711,7 +3712,7 @@ class Target_mips : public Sized_target<size, big_endian>
 
   // Information about this specific target which we pass to the
   // general Target structure.
-  static Target::Target_info mips_info;
+  static const Target::Target_info mips_info;
   // The GOT section.
   Mips_output_data_got<size, big_endian>* got_;
   // gp symbol.  It has the value of .got + 0x7FF0.
@@ -10462,7 +10463,7 @@ Target_mips<size, big_endian>::elf_mips_mach_name(elfcpp::Elf_Word e_flags)
 }
 
 template<int size, bool big_endian>
-Target::Target_info Target_mips<size, big_endian>::mips_info =
+const Target::Target_info Target_mips<size, big_endian>::mips_info =
 {
   size,                 // size
   big_endian,           // is_big_endian
@@ -10488,7 +10489,47 @@ Target::Target_info Target_mips<size, big_endian>::mips_info =
   "__start"		// entry_symbol_name
 };
 
-// The selector for mips object files.
+template<int size, bool big_endian>
+class Target_mips_nacl : public Target_mips<size, big_endian>
+{
+ public:
+  Target_mips_nacl()
+    : Target_mips<size, big_endian>(&mips_nacl_info)
+  { }
+
+ private:
+  static const Target::Target_info mips_nacl_info;
+};
+
+template<int size, bool big_endian>
+const Target::Target_info Target_mips_nacl<size, big_endian>::mips_nacl_info =
+{
+  size,                 // size
+  big_endian,           // is_big_endian
+  elfcpp::EM_MIPS,      // machine_code
+  true,                 // has_make_symbol
+  false,                // has_resolve
+  false,                // has_code_fill
+  true,                 // is_default_stack_executable
+  false,                // can_icf_inline_merge_sections
+  '\0',                 // wrap_char
+  "/lib/ld.so.1",       // dynamic_linker
+  0x20000,              // default_text_segment_address
+  0x10000,              // abi_pagesize (overridable by -z max-page-size)
+  0x10000,              // common_pagesize (overridable by -z common-page-size)
+  true,                 // isolate_execinstr
+  0x10000000,           // rosegment_gap
+  elfcpp::SHN_UNDEF,    // small_common_shndx
+  elfcpp::SHN_UNDEF,    // large_common_shndx
+  0,                    // small_common_section_flags
+  0,                    // large_common_section_flags
+  NULL,                 // attributes_section
+  NULL,                 // attributes_vendor
+  "_start"              // entry_symbol_name
+};
+
+// Target selector for Mips.  Note this is never instantiated directly.
+// It's only used in Target_selector_mips_nacl, below.
 
 template<int size, bool big_endian>
 class Target_selector_mips : public Target_selector
@@ -10508,10 +10549,23 @@ public:
   { return new Target_mips<size, big_endian>(); }
 };
 
-Target_selector_mips<32, true> target_selector_mips32be;
-Target_selector_mips<32, false> target_selector_mips32;
-Target_selector_mips<64, true> target_selector_mips64be;
-Target_selector_mips<64, false> target_selector_mips64;
+template<int size, bool big_endian>
+class Target_selector_mips_nacl
+  : public Target_selector_nacl<Target_selector_mips<size, big_endian>,
+                                Target_mips_nacl<size, big_endian> >
+{
+ public:
+  Target_selector_mips_nacl()
+    : Target_selector_nacl<Target_selector_mips<size, big_endian>,
+                           Target_mips_nacl<size, big_endian> >(
+        // NaCl currently supports only MIPS32 little-endian.
+        "mipsel", "elf32-tradlittlemips-nacl", "elf32-tradlittlemips-nacl")
+  { }
+};
 
+Target_selector_mips_nacl<32, true> target_selector_mips32;
+Target_selector_mips_nacl<32, false> target_selector_mips32el;
+Target_selector_mips_nacl<64, true> target_selector_mips64;
+Target_selector_mips_nacl<64, false> target_selector_mips64el;
 
 } // End anonymous namespace.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add NaCl support to gold for Mips
  2014-08-20 13:37 Add NaCl support to gold for Mips Sasa Stankovic
@ 2014-09-02 16:44 ` Cary Coutant
  2014-09-03  8:42   ` Sasa Stankovic
  0 siblings, 1 reply; 4+ messages in thread
From: Cary Coutant @ 2014-09-02 16:44 UTC (permalink / raw)
  To: Sasa Stankovic; +Cc: binutils, Petar Jovanovic

> The attached patch adds NaCl (NativeClient) specific classes Target_mips_nacl and Target_selector_mips_nacl, and initializes Target_mips_nacl's Target_info structure with NaCl's specific data, similar to how it's implemented for arm, i386 and x86_64.

This is OK with a ChangeLog entry. Thanks!

-cary

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Add NaCl support to gold for Mips
  2014-09-02 16:44 ` Cary Coutant
@ 2014-09-03  8:42   ` Sasa Stankovic
  2014-09-03 16:50     ` Cary Coutant
  0 siblings, 1 reply; 4+ messages in thread
From: Sasa Stankovic @ 2014-09-03  8:42 UTC (permalink / raw)
  To: Cary Coutant; +Cc: binutils, Petar Jovanovic

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

I added ChangeLog entry.

Regards,
Sasa
________________________________________
From: Cary Coutant [ccoutant@google.com]
Sent: Tuesday, September 02, 2014 6:44 PM
To: Sasa Stankovic
Cc: binutils@sourceware.org; Petar Jovanovic
Subject: Re: Add NaCl support to gold for Mips

> The attached patch adds NaCl (NativeClient) specific classes Target_mips_nacl and Target_selector_mips_nacl, and initializes Target_mips_nacl's Target_info structure with NaCl's specific data, similar to how it's implemented for arm, i386 and x86_64.

This is OK with a ChangeLog entry. Thanks!

-cary

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mips-nacl.patch --]
[-- Type: text/x-patch; name="mips-nacl.patch", Size: 4962 bytes --]

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 2c09a05..86decfb 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,17 @@
+2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
+
+	* mips.cc (Target_mips_nacl): New class.
+	(Target_selector_mips_nacl): New class.
+	(target_selector_mips32): Rename from target_selector_mips32be and use
+	Target_selector_mips_nacl instead of Target_selector_mips.
+	(target_selector_mips32el): Rename from target_selector_mips32 and use
+	Target_selector_mips_nacl instead of Target_selector_mips.
+	(target_selector_mips64): Rename from target_selector_mips64be and use
+	Target_selector_mips_nacl instead of Target_selector_mips.
+	(target_selector_mips64el): Rename from target_selector_mips64 and use
+	Target_selector_mips_nacl instead of Target_selector_mips.
+	(Target_mips::mips_info): Add const attribute.
+
 2014-09-02  Cary Coutant  <ccoutant@google.com>
 
 	* dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
diff --git a/gold/mips.cc b/gold/mips.cc
index 450883e..92e1201 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -44,6 +44,7 @@
 #include "tls.h"
 #include "errors.h"
 #include "gc.h"
+#include "nacl.h"
 
 namespace
 {
@@ -3711,7 +3712,7 @@ class Target_mips : public Sized_target<size, big_endian>
 
   // Information about this specific target which we pass to the
   // general Target structure.
-  static Target::Target_info mips_info;
+  static const Target::Target_info mips_info;
   // The GOT section.
   Mips_output_data_got<size, big_endian>* got_;
   // gp symbol.  It has the value of .got + 0x7FF0.
@@ -10462,7 +10463,7 @@ Target_mips<size, big_endian>::elf_mips_mach_name(elfcpp::Elf_Word e_flags)
 }
 
 template<int size, bool big_endian>
-Target::Target_info Target_mips<size, big_endian>::mips_info =
+const Target::Target_info Target_mips<size, big_endian>::mips_info =
 {
   size,                 // size
   big_endian,           // is_big_endian
@@ -10488,7 +10489,47 @@ Target::Target_info Target_mips<size, big_endian>::mips_info =
   "__start"		// entry_symbol_name
 };
 
-// The selector for mips object files.
+template<int size, bool big_endian>
+class Target_mips_nacl : public Target_mips<size, big_endian>
+{
+ public:
+  Target_mips_nacl()
+    : Target_mips<size, big_endian>(&mips_nacl_info)
+  { }
+
+ private:
+  static const Target::Target_info mips_nacl_info;
+};
+
+template<int size, bool big_endian>
+const Target::Target_info Target_mips_nacl<size, big_endian>::mips_nacl_info =
+{
+  size,                 // size
+  big_endian,           // is_big_endian
+  elfcpp::EM_MIPS,      // machine_code
+  true,                 // has_make_symbol
+  false,                // has_resolve
+  false,                // has_code_fill
+  true,                 // is_default_stack_executable
+  false,                // can_icf_inline_merge_sections
+  '\0',                 // wrap_char
+  "/lib/ld.so.1",       // dynamic_linker
+  0x20000,              // default_text_segment_address
+  0x10000,              // abi_pagesize (overridable by -z max-page-size)
+  0x10000,              // common_pagesize (overridable by -z common-page-size)
+  true,                 // isolate_execinstr
+  0x10000000,           // rosegment_gap
+  elfcpp::SHN_UNDEF,    // small_common_shndx
+  elfcpp::SHN_UNDEF,    // large_common_shndx
+  0,                    // small_common_section_flags
+  0,                    // large_common_section_flags
+  NULL,                 // attributes_section
+  NULL,                 // attributes_vendor
+  "_start"              // entry_symbol_name
+};
+
+// Target selector for Mips.  Note this is never instantiated directly.
+// It's only used in Target_selector_mips_nacl, below.
 
 template<int size, bool big_endian>
 class Target_selector_mips : public Target_selector
@@ -10508,10 +10549,23 @@ public:
   { return new Target_mips<size, big_endian>(); }
 };
 
-Target_selector_mips<32, true> target_selector_mips32be;
-Target_selector_mips<32, false> target_selector_mips32;
-Target_selector_mips<64, true> target_selector_mips64be;
-Target_selector_mips<64, false> target_selector_mips64;
+template<int size, bool big_endian>
+class Target_selector_mips_nacl
+  : public Target_selector_nacl<Target_selector_mips<size, big_endian>,
+                                Target_mips_nacl<size, big_endian> >
+{
+ public:
+  Target_selector_mips_nacl()
+    : Target_selector_nacl<Target_selector_mips<size, big_endian>,
+                           Target_mips_nacl<size, big_endian> >(
+        // NaCl currently supports only MIPS32 little-endian.
+        "mipsel", "elf32-tradlittlemips-nacl", "elf32-tradlittlemips-nacl")
+  { }
+};
 
+Target_selector_mips_nacl<32, true> target_selector_mips32;
+Target_selector_mips_nacl<32, false> target_selector_mips32el;
+Target_selector_mips_nacl<64, true> target_selector_mips64;
+Target_selector_mips_nacl<64, false> target_selector_mips64el;
 
 } // End anonymous namespace.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add NaCl support to gold for Mips
  2014-09-03  8:42   ` Sasa Stankovic
@ 2014-09-03 16:50     ` Cary Coutant
  0 siblings, 0 replies; 4+ messages in thread
From: Cary Coutant @ 2014-09-03 16:50 UTC (permalink / raw)
  To: Sasa Stankovic; +Cc: binutils, Petar Jovanovic

> I added ChangeLog entry.

Thanks. I've committed the patch on your behalf.

2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

        * mips.cc (Target_mips_nacl): New class.
        (Target_selector_mips_nacl): New class.
        (target_selector_mips32): Rename from target_selector_mips32be and use
        Target_selector_mips_nacl instead of Target_selector_mips.
        (target_selector_mips32el): Rename from target_selector_mips32 and use
        Target_selector_mips_nacl instead of Target_selector_mips.
        (target_selector_mips64): Rename from target_selector_mips64be and use
        Target_selector_mips_nacl instead of Target_selector_mips.
        (target_selector_mips64el): Rename from target_selector_mips64 and use
        Target_selector_mips_nacl instead of Target_selector_mips.
        (Target_mips::mips_info): Add const attribute.

-cary

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-03 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 13:37 Add NaCl support to gold for Mips Sasa Stankovic
2014-09-02 16:44 ` Cary Coutant
2014-09-03  8:42   ` Sasa Stankovic
2014-09-03 16:50     ` Cary Coutant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).