This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED] BZ#15711: Build syscall.h with -ffreestanding.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, David Miller <davem at davemloft dot net>
- Date: Tue, 16 Jul 2013 18:00:12 -0400
- Subject: [COMMITTED] BZ#15711: Build syscall.h with -ffreestanding.
- References: <51D6B452 dot 30401 at redhat dot com> <mvm38rmuaxl dot fsf at hawking dot suse dot de> <51DD6FEA dot 7010707 at redhat dot com> <51E43A59 dot 60801 at redhat dot com> <87ehaza8cd dot fsf at igel dot home> <51E47396 dot 7090804 at redhat dot com>
On 07/15/2013 06:11 PM, Carlos O'Donell wrote:
> On 07/15/2013 04:14 PM, Andreas Schwab wrote:
>> "Carlos O'Donell" <carlos@redhat.com> writes:
>>
>>> Is there any reason to want to add more internal include
>>> paths as opposed to just using -ffreestanding.
>>
>> Adding -I../include should be enough.
>
> Is there any reason to do that?
>
> What's the downside of using -ffreestanding?
>
> It seems like adding more includes can only slow
> down the building of that file or get us into more
> problems in the future.
>
> What am I missing?
>
> Cheers,
> Carlos.
>
No regressions on x86-64.
Updated NEWS and checked in the following patch for BZ #15711.
v2
- Include comment about why -ffreestanding is used.
2013-07-15 Carlos O'Donell <carlos@redhat.com>
[BZ #15711]
* sysdeps/unix/sysv/linux/Makefile ($(objpfx)bits/syscall%h):
Avoid system header dependency with -ffreestanding.
($(objpfx)bits/syscall%d): Likewise.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index f580635..94916a2 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -50,6 +50,13 @@ tests += tst-clone
# be the condition for those options to use in a C #if condition.
# abi-includes may be defined to a list of headers to include
# in the generated header, if the default does not suffice.
+#
+# The generated header is compiled with `-ffreestanding' to avoid any
+# circular dependencies against the installed implementation headers.
+# Such a dependency would require the implementation header to be
+# installed before the generated header could be built (See bug 15711).
+# In current practice the generated header dependencies do not include
+# any of the implementation headers removed by the use of `-ffreestanding'.
$(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/syscall.h
$(make-target-directory)
@@ -64,7 +71,7 @@ $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/
echo ''; \
$(if $(abi-variants), \
$(foreach v,$(abi-variants),\
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
+ $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
-x c $(sysincludes) $< $(abi-$(v)-options) \
-D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
@@ -75,7 +82,7 @@ $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/
$(if $(abi-$(v)-condition),echo '#endif';) \
rm -f $(@:.d=.h).new$(v); \
), \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
+ $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
-x c $(sysincludes) $< \
-D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \