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.
Why is GNU target including linux.h header at all? TARGET_C99_FUNCTIONS should be overridden in gnu.h anyways.
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.
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
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.
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
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.
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
Subject: Re: [4.2 Regression] GNU Hurd bootstrap error: 'OPTION_GLIBC' undeclared Can you please just apply the patch and close the bug?
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
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
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.
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.
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
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. :-)
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.
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.
(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.
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.
Will not be fixed in 4.2.0; retargeting at 4.2.1.
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..
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.
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
Change target milestone to 4.2.3, as 4.2.2 has been released.
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.
Is it any progress?
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/>
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
4.2.4 is being released, changing milestones to 4.2.5.
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
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. :-)