This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Compile options.c with -fcommon
On Tue, May 16, 2006 at 02:08:13PM -0400, Andrew Pinski wrote:
> >
> > >
> > > On Tue, May 16, 2006 at 10:41:22AM -0700, Andrew Pinski wrote:
> > > >
> > > > On May 16, 2006, at 10:39 AM, H. J. Lu wrote:
> > > >
> > > > >
> > > > >I assume that -fno-common is added by hand since I didn't see it
> > > > >in my build logs on Linux/x86, Linux/x86-64 and Linux/ia64.
> > > >
> > > > No it is not added by hand. It is used when checking is turned on.
> > > > Now I see you did not have checking on which is wrong for development.
> > > >
> > >
> > > Here is a patch to force commoncommon symbols in options.o.
> >
> > This is wrong.
>
> Please read:
> http://gcc.gnu.org/ml/gcc-patches/2002-08/msg01057.html
>
> What you need is a options.c that is only for the driver.
>
> I think both patches should be revert and went back to the drawning boards.
>
Here is a patch to compile gcc-options.o from options.c. I have to
update gcc/java/lang.opt since flag_emit_class_files isn't defined
in any files.
H.J.
----
gcc/
2006-05-16 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.in (GCC_OBJS): Replace options.o with gcc-options.o.
(gcc-options.o): New rule.
* optc-gen.awk: Protect variables for gcc-options.o with
#ifdef GCC_DRIVER/#endif.
gcc/java/
2006-05-16 H.J. Lu <hongjiu.lu@intel.com>
* lang.opt(femit-class-file): Remove VarExists.
--- gcc/Makefile.in.common 2006-05-16 09:26:43.000000000 -0700
+++ gcc/Makefile.in 2006-05-16 11:53:20.000000000 -0700
@@ -961,7 +961,7 @@ C_TARGET_OBJS=@c_target_objs@
CXX_TARGET_OBJS=@cxx_target_objs@
# Object files for gcc driver.
-GCC_OBJS = gcc.o opts-common.o options.o
+GCC_OBJS = gcc.o opts-common.o gcc-options.o
# Language-specific object files for C and Objective C.
C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
@@ -1767,6 +1767,9 @@ s-options-h: optionlist $(srcdir)/opt-fu
options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h
+gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(OUTPUT_OPTION) -DGCC_DRIVER options.c
+
dumpvers: dumpvers.c
version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
--- gcc/java/lang.opt.common 2006-04-25 18:49:30.000000000 -0700
+++ gcc/java/lang.opt 2006-05-16 12:08:34.000000000 -0700
@@ -119,7 +119,7 @@ fcompile-resource=
Java Joined RejectNegative
femit-class-file
-Java Var(flag_emit_class_files) VarExists
+Java Var(flag_emit_class_files)
Output a class file
femit-class-files
--- gcc/optc-gen.awk.common 2006-05-16 09:23:04.000000000 -0700
+++ gcc/optc-gen.awk 2006-05-16 11:57:46.000000000 -0700
@@ -62,7 +62,9 @@ for (i = 1; i <= n_headers; i++)
print "#include " quote "opts.h" quote
print "#include " quote "intl.h" quote
print ""
+print "#ifdef GCC_DRIVER"
print "int target_flags;"
+print "#endif /* GCC_DRIVER */"
print ""
for (i = 0; i < n_opts; i++) {
@@ -75,6 +77,7 @@ for (i = 0; i < n_opts; i++) {
if (name in var_seen)
continue;
init = ""
+ gcc_driver = 1
}
else {
init = opt_args("Init", flags[i])
@@ -82,11 +85,16 @@ for (i = 0; i < n_opts; i++) {
init = " = " init;
else if (name in var_seen)
continue;
+ gcc_driver = 0
}
+ if (gcc_driver == 1)
+ print "#ifdef GCC_DRIVER"
print "/* Set by -" opts[i] "."
print " " help[i] " */"
print var_type(flags[i]) name init ";"
+ if (gcc_driver == 1)
+ print "#endif /* GCC_DRIVER */"
print ""
var_seen[name] = 1;