This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto][patch] Move common.c and common.h from lto-plugin/ to gcc/lto/
- From: "Rafael Espindola" <espindola at google dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: "Diego Novillo" <dnovillo at google dot com>
- Date: Tue, 23 Sep 2008 15:13:04 +0100
- Subject: [lto][patch] Move common.c and common.h from lto-plugin/ to gcc/lto/
I will need to use it in lto1, and it is easier to use something in
gcc/lto/ in lto-plugin than the other way around.
gcc/lto
2008-09-23 Rafael Espindola <espindola@google.com>
* common.c: Moved from lto-plugin.
* common.h: Moved from lto-plugin.
lto-plugin/
2008-09-23 Rafael Espindola <espindola@google.com>
* Makefile.am (ltosymtab_SOURCES, liblto_plugin_la_SOURCES):
Update the location of common.c.
* Makefile.in: Regenerate.
* common.c: Moved to gcc/lto.
* common.h: Moved to gcc/lto.
* lto-plugin.c: Update the location of common.h.
* lto-symtab.c: Update the location of common.h.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/lto/common.c b/gcc/lto/common.c
new file mode 100644
index 0000000..ef3af29
--- /dev/null
+++ b/gcc/lto/common.c
@@ -0,0 +1,45 @@
+/* LTO plugin for gold.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Rafael Avila de Espindola (espindola@google.com).
+
+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 "common.h"
+
+const char *lto_kind_str[5] __attribute__ ((visibility ("hidden"))) =
+{
+ "DEF", "WEAKDEF", "UNDEF",
+ "WEAKUNDEF", "COMMON"
+};
+
+const char *lto_visibility_str[4] __attribute__ ((visibility ("hidden"))) =
+{
+ "DEFAULT", "PROTECTED",
+ "INTERNAL", "HIDDEN"
+};
+
+const char *lto_resolution_str[9] __attribute__ ((visibility ("hidden"))) =
+{
+ "UNKNOWN",
+ "UNDEF",
+ "PREVAILING_DEF",
+ "PREVAILING_DEF_IRONLY",
+ "PREEMPTED_REG",
+ "PREEMPTED_IR",
+ "RESOLVED_IR",
+ "RESOLVED_EXEC",
+ "RESOLVED_DYN"
+};
+
diff --git a/gcc/lto/common.h b/gcc/lto/common.h
new file mode 100644
index 0000000..35b5192
--- /dev/null
+++ b/gcc/lto/common.h
@@ -0,0 +1,25 @@
+/* LTO plugin for gold.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Rafael Avila de Espindola (espindola@google.com).
+
+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. */
+
+extern const char *lto_kind_str[5] __attribute__ ((visibility ("hidden")));
+
+extern const char *
+lto_visibility_str[4] __attribute__ ((visibility ("hidden")));
+
+extern const char *
+lto_resolution_str[9] __attribute__ ((visibility ("hidden")));
diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index 66170db..b7d98f5 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -4,12 +4,12 @@ AM_CFLAGS = -Wall -Werror
bin_PROGRAMS = ltosymtab
-ltosymtab_SOURCES = lto-symtab.c common.c
+ltosymtab_SOURCES = lto-symtab.c $(top_srcdir)/../gcc/lto/common.c
ltosymtab_LDADD = -ldl -lelf
#hack to use common.c in both targets
ltosymtab_CFLAGS = $(AM_CFLAGS)
lib_LTLIBRARIES = liblto_plugin.la
-liblto_plugin_la_SOURCES = lto-plugin.c common.c
+liblto_plugin_la_SOURCES = lto-plugin.c $(top_srcdir)/../gcc/lto/common.c
liblto_plugin_la_LIBADD = -lelf
diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in
index 4c64b4b..9c10511 100644
--- a/lto-plugin/Makefile.in
+++ b/lto-plugin/Makefile.in
@@ -199,12 +199,12 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
AM_CPPFLAGS = -I$(top_srcdir)/../include
AM_CFLAGS = -Wall -Werror
-ltosymtab_SOURCES = lto-symtab.c common.c
+ltosymtab_SOURCES = lto-symtab.c $(top_srcdir)/../gcc/lto/common.c
ltosymtab_LDADD = -ldl -lelf
#hack to use common.c in both targets
ltosymtab_CFLAGS = $(AM_CFLAGS)
lib_LTLIBRARIES = liblto_plugin.la
-liblto_plugin_la_SOURCES = lto-plugin.c common.c
+liblto_plugin_la_SOURCES = lto-plugin.c $(top_srcdir)/../gcc/lto/common.c
liblto_plugin_la_LIBADD = -lelf
all: all-am
@@ -336,6 +336,13 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+common.lo: $(top_srcdir)/../gcc/lto/common.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common.lo -MD -MP -MF "$(DEPDIR)/common.Tpo" -c -o common.lo `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/common.Tpo" "$(DEPDIR)/common.Plo"; else rm -f "$(DEPDIR)/common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/../gcc/lto/common.c' object='common.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common.lo `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c
+
ltosymtab-lto-symtab.o: lto-symtab.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-lto-symtab.o -MD -MP -MF "$(DEPDIR)/ltosymtab-lto-symtab.Tpo" -c -o ltosymtab-lto-symtab.o `test -f 'lto-symtab.c' || echo '$(srcdir)/'`lto-symtab.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ltosymtab-lto-symtab.Tpo" "$(DEPDIR)/ltosymtab-lto-symtab.Po"; else rm -f "$(DEPDIR)/ltosymtab-lto-symtab.Tpo"; exit 1; fi
@@ -350,19 +357,19 @@ ltosymtab-lto-symtab.obj: lto-symtab.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-lto-symtab.obj `if test -f 'lto-symtab.c'; then $(CYGPATH_W) 'lto-symtab.c'; else $(CYGPATH_W) '$(srcdir)/lto-symtab.c'; fi`
-ltosymtab-common.o: common.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-common.o -MD -MP -MF "$(DEPDIR)/ltosymtab-common.Tpo" -c -o ltosymtab-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c; \
+ltosymtab-common.o: $(top_srcdir)/../gcc/lto/common.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-common.o -MD -MP -MF "$(DEPDIR)/ltosymtab-common.Tpo" -c -o ltosymtab-common.o `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ltosymtab-common.Tpo" "$(DEPDIR)/ltosymtab-common.Po"; else rm -f "$(DEPDIR)/ltosymtab-common.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ltosymtab-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/../gcc/lto/common.c' object='ltosymtab-common.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-common.o `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c
-ltosymtab-common.obj: common.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-common.obj -MD -MP -MF "$(DEPDIR)/ltosymtab-common.Tpo" -c -o ltosymtab-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`; \
+ltosymtab-common.obj: $(top_srcdir)/../gcc/lto/common.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-common.obj -MD -MP -MF "$(DEPDIR)/ltosymtab-common.Tpo" -c -o ltosymtab-common.obj `if test -f '$(top_srcdir)/../gcc/lto/common.c'; then $(CYGPATH_W) '$(top_srcdir)/../gcc/lto/common.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../gcc/lto/common.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ltosymtab-common.Tpo" "$(DEPDIR)/ltosymtab-common.Po"; else rm -f "$(DEPDIR)/ltosymtab-common.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common.c' object='ltosymtab-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/../gcc/lto/common.c' object='ltosymtab-common.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-common.obj `if test -f '$(top_srcdir)/../gcc/lto/common.c'; then $(CYGPATH_W) '$(top_srcdir)/../gcc/lto/common.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../gcc/lto/common.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
diff --git a/lto-plugin/common.c b/lto-plugin/common.c
deleted file mode 100644
index ef3af29..0000000
--- a/lto-plugin/common.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* LTO plugin for gold.
- Copyright (C) 2008 Free Software Foundation, Inc.
- Contributed by Rafael Avila de Espindola (espindola@google.com).
-
-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 "common.h"
-
-const char *lto_kind_str[5] __attribute__ ((visibility ("hidden"))) =
-{
- "DEF", "WEAKDEF", "UNDEF",
- "WEAKUNDEF", "COMMON"
-};
-
-const char *lto_visibility_str[4] __attribute__ ((visibility ("hidden"))) =
-{
- "DEFAULT", "PROTECTED",
- "INTERNAL", "HIDDEN"
-};
-
-const char *lto_resolution_str[9] __attribute__ ((visibility ("hidden"))) =
-{
- "UNKNOWN",
- "UNDEF",
- "PREVAILING_DEF",
- "PREVAILING_DEF_IRONLY",
- "PREEMPTED_REG",
- "PREEMPTED_IR",
- "RESOLVED_IR",
- "RESOLVED_EXEC",
- "RESOLVED_DYN"
-};
-
diff --git a/lto-plugin/common.h b/lto-plugin/common.h
deleted file mode 100644
index 35b5192..0000000
--- a/lto-plugin/common.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* LTO plugin for gold.
- Copyright (C) 2008 Free Software Foundation, Inc.
- Contributed by Rafael Avila de Espindola (espindola@google.com).
-
-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. */
-
-extern const char *lto_kind_str[5] __attribute__ ((visibility ("hidden")));
-
-extern const char *
-lto_visibility_str[4] __attribute__ ((visibility ("hidden")));
-
-extern const char *
-lto_resolution_str[9] __attribute__ ((visibility ("hidden")));
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 3ca7ec4..09d109f 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#endif
#include "plugin-api.h"
-#include "common.h"
+#include "../gcc/lto/common.h"
/* The part of the symbol table the plugin has to keep track of. Note that we
must keep SYMS until all_symbols_read is called to give the linker time to
diff --git a/lto-plugin/lto-symtab.c b/lto-plugin/lto-symtab.c
index 32ef260..210f4a3 100644
--- a/lto-plugin/lto-symtab.c
+++ b/lto-plugin/lto-symtab.c
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include "plugin-api.h"
-#include "common.h"
+#include "../gcc/lto/common.h"
#ifdef HAVE_GELF_H
# include <gelf.h>