OSDN Git Service

Change export code to use the backend interface.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2011 22:46:11 +0000 (22:46 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2011 22:46:11 +0000 (22:46 +0000)
* go-backend.c: Include "output.h".
(go_write_export_data): New function.
* go-c.h (go_write_export_data): Declare.
* Make-lang.in (go/go-backend.o): Depend on output.h.
(go/export.o): Depend on $(GO_C_H).  Do not depend on
$(MACHMODE_H), output.h, or $(TARGET_H).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174366 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/ChangeLog
gcc/go/Make-lang.in
gcc/go/go-backend.c
gcc/go/go-c.h
gcc/go/gofrontend/export.cc
gcc/go/gofrontend/export.h

index 1e936a6..5df1e05 100644 (file)
@@ -1,3 +1,12 @@
+2011-05-27  Ian Lance Taylor  <iant@google.com>
+
+       * go-backend.c: Include "output.h".
+       (go_write_export_data): New function.
+       * go-c.h (go_write_export_data): Declare.
+       * Make-lang.in (go/go-backend.o): Depend on output.h.
+       (go/export.o): Depend on $(GO_C_H).  Do not depend on
+       $(MACHMODE_H), output.h, or $(TARGET_H).
+
 2011-05-24  Joseph Myers  <joseph@codesourcery.com>
 
        * Make-lang.in (GCCGO_OBJS): Remove prefix.o.
 2011-05-24  Joseph Myers  <joseph@codesourcery.com>
 
        * Make-lang.in (GCCGO_OBJS): Remove prefix.o.
index 82e219b..ef5dc75 100644 (file)
@@ -224,7 +224,7 @@ GO_IMPORT_H = go/gofrontend/import.h go/gofrontend/export.h
 GO_RUNTIME_H = go/gofrontend/runtime.h go/gofrontend/runtime.def
 
 go/go-backend.o: go/go-backend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 GO_RUNTIME_H = go/gofrontend/runtime.h go/gofrontend/runtime.def
 
 go/go-backend.o: go/go-backend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-       $(TM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(TARGET_H)
+       $(TM_H) $(RTL_H) $(TREE_H) $(TM_P_H) output.h $(TARGET_H)
 
 go/go-lang.o: go/go-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
                $(TREE_H) $(GIMPLE_H) $(GGC_H) $(TOPLEV_H) debug.h options.h \
 
 go/go-lang.o: go/go-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
                $(TREE_H) $(GIMPLE_H) $(GGC_H) $(TOPLEV_H) debug.h options.h \
@@ -248,8 +248,8 @@ go/%.o: go/gofrontend/%.cc
 go/dataflow.o: go/gofrontend/dataflow.cc $(GO_SYSTEM_H) $(GO_GOGO_H) \
        $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) go/gofrontend/dataflow.h
 go/export.o: go/gofrontend/export.cc $(GO_SYSTEM_H) \
 go/dataflow.o: go/gofrontend/dataflow.cc $(GO_SYSTEM_H) $(GO_GOGO_H) \
        $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) go/gofrontend/dataflow.h
 go/export.o: go/gofrontend/export.cc $(GO_SYSTEM_H) \
-       $(srcdir)/../include/sha1.h $(MACHMODE_H) output.h $(TARGET_H) \
-       $(GO_GOGO_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) go/gofrontend/export.h
+       $(srcdir)/../include/sha1.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
+       $(GO_STATEMENTS_H) go/gofrontend/export.h
 go/expressions.o: go/gofrontend/expressions.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
        intl.h $(TREE_H) $(GIMPLE_H) tree-iterator.h convert.h $(REAL_H) \
        realmpfr.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
 go/expressions.o: go/gofrontend/expressions.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
        intl.h $(TREE_H) $(GIMPLE_H) tree-iterator.h convert.h $(REAL_H) \
        realmpfr.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
index 5ecc99b..60a97db 100644 (file)
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "tm_p.h"
 #include "rtl.h"
 #include "tree.h"
 #include "tm_p.h"
+#include "output.h"
 #include "target.h"
 
 #include "go-c.h"
 #include "target.h"
 
 #include "go-c.h"
@@ -91,3 +92,21 @@ go_imported_unsafe (void)
   /* Let the backend know that the options have changed.  */
   targetm.override_options_after_change ();
 }
   /* Let the backend know that the options have changed.  */
   targetm.override_options_after_change ();
 }
+
+/* This is called by the Go frontend proper to add data to the
+   .go_export section.  */
+
+void
+go_write_export_data (const char *bytes, unsigned int size)
+{
+  static section* sec;
+
+  if (sec == NULL)
+    {
+      gcc_assert (targetm.have_named_sections);
+      sec = get_section (".go_export", SECTION_DEBUG, NULL);
+    }
+
+  switch_to_section (sec);
+  assemble_string (bytes, size);
+}
index 1c7a3b1..f70f1ad 100644 (file)
@@ -66,6 +66,8 @@ extern void go_trampoline_info (unsigned int *size, unsigned int *alignment);
 
 extern void go_imported_unsafe (void);
 
 
 extern void go_imported_unsafe (void);
 
+extern void go_write_export_data (const char *, unsigned int);
+
 #if defined(__cplusplus) && !defined(ENABLE_BUILD_WITH_CXX)
 } /* End extern "C".  */
 #endif
 #if defined(__cplusplus) && !defined(ENABLE_BUILD_WITH_CXX)
 } /* End extern "C".  */
 #endif
index 538fb97..48088ad 100644 (file)
@@ -5,20 +5,10 @@
 // license that can be found in the LICENSE file.
 
 #include "go-system.h"
 // license that can be found in the LICENSE file.
 
 #include "go-system.h"
-#include "sha1.h"
-
-#ifndef ENABLE_BUILD_WITH_CXX
-extern "C"
-{
-#endif
 
 
-#include "machmode.h"
-#include "output.h"
-#include "target.h"
+#include "sha1.h"
 
 
-#ifndef ENABLE_BUILD_WITH_CXX
-}
-#endif
+#include "go-c.h"
 
 #include "gogo.h"
 #include "types.h"
 
 #include "gogo.h"
 #include "types.h"
@@ -416,7 +406,6 @@ Export::Stream::write_checksum(const std::string& s)
 // Class Stream_to_section.
 
 Stream_to_section::Stream_to_section()
 // Class Stream_to_section.
 
 Stream_to_section::Stream_to_section()
-  : section_(NULL)
 {
 }
 
 {
 }
 
@@ -425,15 +414,5 @@ Stream_to_section::Stream_to_section()
 void
 Stream_to_section::do_write(const char* bytes, size_t length)
 {
 void
 Stream_to_section::do_write(const char* bytes, size_t length)
 {
-  section* sec = (section*) this->section_;
-  if (sec == NULL)
-    {
-      go_assert(targetm.have_named_sections);
-
-      sec = get_section(".go_export", SECTION_DEBUG, NULL);
-      this->section_ = (void*) sec;
-    }
-
-  switch_to_section(sec);
-  assemble_string(bytes, length);
+  go_write_export_data (bytes, length);
 }
 }
index 4a1fd2b..ef24977 100644 (file)
@@ -179,11 +179,6 @@ class Stream_to_section : public Export::Stream
  protected:
   void
   do_write(const char*, size_t);
  protected:
   void
   do_write(const char*, size_t);
-
- private:
-  // The section we are writing to; this is really union section
-  // defined in output.h.
-  void* section_;
 };
 
 #endif // !defined(GO_EXPORT_H)
 };
 
 #endif // !defined(GO_EXPORT_H)