Bug 28102 - [4.2/4.3/4.4 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared
Summary: [4.2/4.3/4.4 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P5 normal
Target Milestone: 4.4.0
Assignee: Thomas Schwinge
URL:
Keywords: build
Depends on:
Blocks: 21824
  Show dependency treegraph
 
Reported: 2006-06-20 17:43 UTC by Martin Michlmayr
Modified: 2021-09-11 23:33 UTC (History)
8 users (show)

See Also:
Host:
Target: i486-gnu
Build: i486-gnu
Known to work:
Known to fail:
Last reconfirmed: 2008-11-13 23:40:06


Attachments
Fixes #28102 (309 bytes, patch)
2006-07-15 13:45 UTC, Alfred M. Szmidt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-06-20 17:43:30 UTC
GCC 4.2 on GNU Hurd currently fails to bootstrap with the following error:

> cc -c   -g -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -fno-common   -DHAVE_CONFIG_H -I. -I. -I../../src/gcc -I../../sr
c/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -I../../src/gcc/../libdecnumber
-I../libdecnumber    ../../src/gcc/c-common.c -o c-common.o
> In file included from ../../src/gcc/c-common.c:3367:
> ../../src/gcc/builtins.def: In function 'c_common_nodes_and_builtins':
> ../../src/gcc/builtins.def:178: error: 'OPTION_GLIBC' undeclared (first use in this function)
> ../../src/gcc/builtins.def:178: error: (Each undeclared identifier is reported only once
> ../../src/gcc/builtins.def:178: error: for each function it appears in.)
> make[5]: *** [c-common.o] Error 1
> make[5]: Leaving directory `/build/buildd/gcc-snapshot-20060613/build/gcc'

This is probably due to the patch from
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01493.html
commit
r111235 | jsm28 | 2006-02-18 12:12:51 +0100 (Sat, 18 Feb 2006) | 82 lines

The glibc dynamic linker on GNU is /lib/ld.so.1

I tried to define GLIBC_DYNAMIC_LINKER in gcc/config/gnu.h but it seems that's not the right fix.
Comment 1 Andrew Pinski 2006-06-20 17:50:09 UTC
Why is GNU target including linux.h header at all?
TARGET_C99_FUNCTIONS should be overridden in gnu.h anyways.
Comment 2 Alfred M. Szmidt 2006-07-15 13:45:51 UTC
Created attachment 11892 [details]
Fixes #28102

(In reply to comment #1)
> Why is GNU target including linux.h header at all?
> TARGET_C99_FUNCTIONS should be overridden in gnu.h anyways.

Because the rules in config.gcc say so:

*-*-gnu*)
...
    i[34567]86-*-*)
      tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h elfos.\
h svr4.h linux.h i386/linux.h gnu.h ${tm_file}"
...


Here is a patch that fixes the problem.

gcc/ChangeLog
2006-07-15  Alfred M. Szmidt  <ams@gnu.org>

       * config/i386/gnu.h (TARGET_C99_FUNCTIONS): Undefine macro.
Comment 3 pinskia@gmail.com 2006-07-15 14:56:43 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared


On Jul 15, 2006, at 10:45 PM, ams at gnu dot org wrote:

> Because the rules in config.gcc say so:

And that is not why, but that is what is causing linux.h being included?
Again why is Linux.h being included?

-- Pinski

Comment 4 Alfred M. Szmidt 2006-07-15 15:17:02 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

   > Because the rules in config.gcc say so:

   And that is not why, but that is what is causing linux.h being
   included?  Again why is Linux.h being included?

GNU and GNU/Linux are similar enough not to warrant duplication of the
code from linux.h in gnu.h.
Comment 5 Andrew Pinski 2006-07-15 15:27:27 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared


On Jul 16, 2006, at 12:17 AM, ams at gnu dot org wrote:

> GNU and GNU/Linux are similar enough not to warrant duplication of the
> code from linux.h in gnu.h.

Depends, the duplication is small anyways as linux.h is only 129 lines
(including copyright and comments).
In fact it is way wrong now anyways as there is no uclibc for hurd.


So the duplication factor should not matter as there is hardly any
duplication.

Only the following code will be duplicated which is hardly any after  
all:
/* Don't assume anything about the header files.  */
#define NO_IMPLICIT_EXTERN_C

#undef ASM_APP_ON
#define ASM_APP_ON "#APP\n"

#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"

#undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX

#undef  STARTFILE_SPEC
#if defined HAVE_LD_PIE
#define STARTFILE_SPEC \
   "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o% 
s;:crtbegin.o%s}"
#else
#define STARTFILE_SPEC \
   "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o% 
s;:crtbegin.o%s}"
#endif


#undef  ENDFILE_SPEC
#define ENDFILE_SPEC \
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"

#ifndef CC1_SPEC
#define CC1_SPEC "%{profile:-p}"
#endif

#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"

#if defined(HAVE_LD_EH_FRAME_HDR)
#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
#endif

/* Define this so we can compile MS code for use with WINE.  */
#define HANDLE_PRAGMA_PACK_PUSH_POP

#define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"

/* Use --as-needed -lgcc_s for eh support.  */
#ifdef HAVE_LD_AS_NEEDED
#define USE_LD_AS_NEEDED 1
#endif

#define TARGET_POSIX_IO

-- Pinski
Comment 6 Alfred M. Szmidt 2006-07-15 15:45:53 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

   Only the following code will be duplicated which is hardly any
   after all:

That is from [gcc]/gcc/config/linux.h, I'm talking about
[gcc]/gcc/config/i386/{linux,gnu}.h.  Which is also the one causing
problems without the patch I sent.

I don't want/have time/etc to worry about this right now, it isn't a
very high priority thing anyway.  I also don't think it is a very good
idea to copy the content form */linux.h into */gnu.h...

FYI, GNU/k*BSD also uses the GNU/Linux headers, and it doesn't support
uclibc AFAIK.

Cheers.
Comment 7 Andrew Pinski 2006-07-15 15:58:33 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared


On Jul 16, 2006, at 12:45 AM, ams at gnu dot org wrote:

> That is from [gcc]/gcc/config/linux.h, I'm talking about
> [gcc]/gcc/config/i386/{linux,gnu}.h.  Which is also the one causing
> problems without the patch I sent.

bzzz, wrong. TARGET_C99_FUNCTIONS is not defined anywhere in
config/i386/linux.h, it is defined in config/linux.h.  Also
powerpc-gnu and alpha-gnu are going to have the same issue.
powerpc-gnu is worse though.

Please try again at actually looking into this issue.
It is obviously you did not look into that much.

Also kBSD is incorrect anyways and should be fixed in the same
matter but that is a different bug.


-- Pinski
Comment 8 Alfred M. Szmidt 2006-07-15 16:07:37 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

Can you please just apply the patch and close the bug?
Comment 9 Andrew Pinski 2006-07-15 16:10:46 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared


On Jul 16, 2006, at 1:07 AM, ams at gnu dot org wrote:

> Can you please just apply the patch and close the bug?

Why it is not obvious and I say the patch is incorrect.

-- Pinski
Comment 10 Andrew Pinski 2006-07-15 16:14:33 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared


On Jul 16, 2006, at 1:10 AM, Andrew Pinski wrote:
>
> Why it is not obvious and I say the patch is incorrect.

Oh did I forget (again) to say you really should be posting
patches to the gcc-patches mailing list. If you want them
be included.  And I still say the patch is incorrect.  I already
explained why I thought it was incorrect as linux.h should not
be included.  Also the comment in your patch is incorrect
as the definition comes from config/linux.h and not from
config/i386/linux.h.

-- Pinski
Comment 11 Alfred M. Szmidt 2006-07-15 16:25:10 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

   > Can you please just apply the patch and close the bug?

   Why it is not obvious and I say the patch is incorrect.

The patch is correct, that you think that the code we use from
*/linux.h should be in */gnu.h is not related to this bug.  This is
the setup we have used for almost 10 years, and I see no reason to
change it.  The setup works, it minimises the workload on both
parties, and it is clean.

If you don't want to commit the patch then that is fine, it isn't like
GCC can even compile on the GNU system due to the other bugs with
patches being neglected (mostly by me).

Happy hacking.
Comment 12 Alfred M. Szmidt 2006-07-15 16:27:58 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

   Oh did I forget (again) to say you really should be posting patches
   to the gcc-patches mailing list.

Thanks.  I'm actually quite aware of that.  I haven't gotten around to
cleaning it all up so that I can send it to gcc-patches@ in one go.

   Also the comment in your patch is incorrect as the definition comes
   from config/linux.h and not from config/i386/linux.h.

Thanks.  I confused it with config/alpha/linux which defines
TARGET_C99_FUNCTIONS.

Cheers.
Comment 13 Andrew Pinski 2006-07-15 16:29:11 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared


On Jul 16, 2006, at 1:25 AM, ams at gnu dot org wrote:

> The patch is correct, that you think that the code we use from
> */linux.h should be in */gnu.h is not related to this bug.  This is
> the setup we have used for almost 10 years, and I see no reason to
> change it.  The setup works, it minimises the workload on both
> parties, and it is clean.

Actually you are incorrect about not being related to this bug
as it is the reason why this bug showed up and it is not clean
as shown by this bug.

Move along and fix/post a correct fix to the mailing list.

-- Pinski
Comment 14 Alfred M. Szmidt 2006-07-15 16:55:45 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

I think we will have to agree to disagree on this, since neither you
or I will change our minds. :-)
Comment 15 Martin Michlmayr 2006-07-26 15:25:00 UTC
One of our (Debian's) Hurd porters has confirmed that this patch works.  Alfred, can you please clean it up and submit it to gcc-patches.
Comment 16 Alfred M. Szmidt 2006-07-26 15:35:41 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

I'll try to get around it as soon as I can.  Thanks.
Comment 17 Martin Michlmayr 2006-08-23 18:53:11 UTC
(In reply to comment #16)
> Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC'
> undeclared
> 
> I'll try to get around it as soon as I can.  Thanks.

It has been a month... would be nice if you could look at it soon.
Comment 18 Alfred M. Szmidt 2006-08-24 18:05:05 UTC
Subject: Re:  [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

   > I'll try to get around it as soon as I can.  Thanks.

   It has been a month... would be nice if you could look at it soon.

Thanks for poking, I got stuck on a strange bug that causes make to
assert while building the Java bits and I haven't gotten around to
fixing it.  I'll try and get around to atleast fixing this bug ASAP;
which may take some time. :( Is there a hurry getting this in, I could
try and reprioritise my tasks if it is urgent.

Happy hacking, and thanks.
Comment 19 Mark Mitchell 2007-05-14 22:28:19 UTC
Will not be fixed in 4.2.0; retargeting at 4.2.1.
Comment 20 Bernhard Reutner-Fischer 2007-10-01 11:55:15 UTC
Tripping exactly this while thinking about uclibc on hurd.

To me it looks like linux.h shouldn't be included and gnu.h should be made uclibc-aware..
Comment 21 Alfred M. Szmidt 2007-10-01 18:04:08 UTC
Subject: Re:  [4.2/4.3 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

   To me it looks like linux.h shouldn't be included

It should be included.

   and gnu.h should be made uclibc-aware..

This would be nice, would you like to do that?  I have far to much to
handle right now.
Comment 22 Andrew Pinski 2007-10-01 18:36:18 UTC
Subject: Re:  [4.2/4.3 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared

On 1 Oct 2007 18:04:09 -0000, ams at gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #21 from ams at gnu dot org  2007-10-01 18:04 -------
> Subject: Re:  [4.2/4.3 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC'
> undeclared
>
>    To me it looks like linux.h shouldn't be included
>
> It should be included.

Again why?  You still have not explained why HURD is Linux?  Because
as far as I can tell it is not.

-- Pinski
Comment 23 Mark Mitchell 2007-10-09 19:22:21 UTC
Change target milestone to 4.2.3, as 4.2.2 has been released.
Comment 24 Samuel Thibault 2007-11-04 16:42:45 UTC
It's rather the converse: Linux is much like Hurd, since they're both GNU-based, so quite logically they should share most of the configuration stuff. 
Comment 25 ojab 2007-12-27 17:17:29 UTC
Is it any progress?
Comment 26 Thomas Schwinge 2007-12-27 18:23:06 UTC
Here is what I proposed / asked: <http://gcc.gnu.org/ml/gcc/2007-11/msg00289.html>

Unfortunately I didn't get a definitive answer.  I did not yet start to implement the ideas I described.  I don't know if such a patch would finally be applied to the GCC repository.

In the mean time I'm using these patches: <http://www.schwinge.homeip.net/~thomas/tmp/gcc-patches/>
Comment 27 Joseph S. Myers 2008-02-01 16:53:06 UTC
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
Comment 28 Joseph S. Myers 2008-05-19 20:22:52 UTC
4.2.4 is being released, changing milestones to 4.2.5.
Comment 29 Thomas Schwinge 2008-11-13 23:30:17 UTC
Subject: Bug 28102

Author: tschwinge
Date: Thu Nov 13 23:28:46 2008
New Revision: 141838

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141838
Log:
2008-11-13  Thomas Schwinge  <tschwinge@gnu.org>

	PR target/28102
	* config.gcc (*-*-gnu*): Move Alpha parts into the `alpha*-*-gnu*', x86
	parts into the `i[34567]86-*-linux*' and parts that are independent of
	the processor architecture into the `*-*-linux*' cases.
	(*-*-linux*): Consider `linux.opt' only for Linux-based configurations.
	* config/i386/gnu.h (GLIBC_DYNAMIC_LINKER): Redefine.
	(TARGET_OS_CPP_BUILTINS, LINK_SPEC): Don't redefine.
	[TARGET_LIBC_PROVIDES_SSP] (TARGET_THREAD_SSP_OFFSET): Undefine.
	* config/gnu.h (NO_IMPLICIT_EXTERN_C): Don't redefine.
	(HURD_TARGET_OS_CPP_BUILTINS): Don't define, but instead...
	(LINUX_TARGET_OS_CPP_BUILTINS): Redefine.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/gcc/config/gnu.h
    trunk/gcc/config/i386/gnu.h

Comment 30 Thomas Schwinge 2008-11-13 23:42:21 UTC
I have fixed this on the GCC trunk.  Installing this fix on the 4.2 and 4.3 branches would be very difficult I was told, so we're going to abstain from even trying and are happy with a functional GCC trunk / 4.4 again.  :-)