Mailing List Archive

Inheriting CFLAGS
I am attempting to install Xen-2.0 using the Gentoo Ebuilds written by
Philip Taylor, and have run into the same problem as A Streecar Named
with needing to implement the -nopie flag.

As part of the Portage system, Gentoo users are able to specify their
CFLAGS in a file which is exported to the environment in which the
program is configured, built and installed.

Is it possible to have Xen inherit these CFLAGS as a base, and then
modify them as required? Part of the enthusiasm over Gentoo is the
ability to customise and optimise the applications.

Thanks in advance

Jerome


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
> I am attempting to install Xen-2.0 using the Gentoo Ebuilds written by Philip
> Taylor, and have run into the same problem as A Streecar Named with needing to
> implement the -nopie flag.

strange, I didn't have to do it (using ebuilds from
http://bugs.gentoo.org/show_bug.cgi?id=70161)

> As part of the Portage system, Gentoo users are able to specify their CFLAGS
> in a file which is exported to the environment in which the program is
> configured, built and installed.
>
> Is it possible to have Xen inherit these CFLAGS as a base, and then modify
> them as required? Part of the enthusiasm over Gentoo is the ability to
> customise and optimise the applications.

If you're talking about kernel, I don't think it's a good idea. None of
the packages under sys-kernel inherits CFLAGS from Portage's
/etc/make.conf.

j.



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
> > I am attempting to install Xen-2.0 using the Gentoo Ebuilds written by Philip
> > Taylor, and have run into the same problem as A Streecar Named with needing to
> > implement the -nopie flag.
>
> strange, I didn't have to do it (using ebuilds from
> http://bugs.gentoo.org/show_bug.cgi?id=70161)

Yes, I did wonder about this.

Can you take a look in xen/arch/x86/Rules.mk and see if you have the
lines:
# Disable PIE/SSP if GCC supports them. They can break us.
CFLAGS += $(call test-gcc-flag,-nopie)
CFLAGS += $(call test-gcc-flag,-fno-stack-protector)
CFLAGS += $(call test-gcc-flag,-fno-stack-protector-all)

If so then you have a *very* up-to-date tree. :-) I recently checked
in a build fix that would disable PIE/SSP iff they are supported by
GCC.

If not then I'm confused!

> > Is it possible to have Xen inherit these CFLAGS as a base, and then modify
> > them as required? Part of the enthusiasm over Gentoo is the ability to
> > customise and optimise the applications.
>
> If you're talking about kernel, I don't think it's a good idea. None of
> the packages under sys-kernel inherits CFLAGS from Portage's
> /etc/make.conf.

Yeah, it's a bad idea! Kernels are very sensitive to compile flags
-- both Xen and Linux use a wide range of GCC features and frequently
use inline assembler, so the code is fragile when flags are changed
from what we developers use. Allowing CFLAGS to be modified would be
giving users a loaded gun. :-)

-- Keir


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
No, I do not have those lines in my Rules.mk file. It was downloaded
this morning using the ebuild, so was the xen-2.0.tgz file from
sourceforge. If I add -nopie to the CFLAGS in Rules.mk file xen will
compile fine, however if I add -nopie to my environment CFLAGS it does
not get picked up by the xen build script. Therefore I can compile and
install it, but it takes manual intervention, which defeats the idea of
using an ebuild :)

I am not looking of inheriting CFLAGS into the kernel build process - I
agree that it is bad. However I am unable to build Xen-2.0 itself with
my compiler. Unfortunately, unlike with GCC 3.4, it doesn't compile a
non-SSP/PIE version of gcc to use. (I'm running gcc 3.3.4)

Keir Fraser wrote:
>>>I am attempting to install Xen-2.0 using the Gentoo Ebuilds written by Philip
>>>Taylor, and have run into the same problem as A Streecar Named with needing to
>>>implement the -nopie flag.
>>
>>strange, I didn't have to do it (using ebuilds from
>>http://bugs.gentoo.org/show_bug.cgi?id=70161)
>
>
> Yes, I did wonder about this.
>
> Can you take a look in xen/arch/x86/Rules.mk and see if you have the
> lines:
> # Disable PIE/SSP if GCC supports them. They can break us.
> CFLAGS += $(call test-gcc-flag,-nopie)
> CFLAGS += $(call test-gcc-flag,-fno-stack-protector)
> CFLAGS += $(call test-gcc-flag,-fno-stack-protector-all)
>
> If so then you have a *very* up-to-date tree. :-) I recently checked
> in a build fix that would disable PIE/SSP iff they are supported by
> GCC.
>
> If not then I'm confused!
>
>
>>>Is it possible to have Xen inherit these CFLAGS as a base, and then modify
>>>them as required? Part of the enthusiasm over Gentoo is the ability to
>>>customise and optimise the applications.
>>
>>If you're talking about kernel, I don't think it's a good idea. None of
>>the packages under sys-kernel inherits CFLAGS from Portage's
>>/etc/make.conf.
>
>
> Yeah, it's a bad idea! Kernels are very sensitive to compile flags
> -- both Xen and Linux use a wide range of GCC features and frequently
> use inline assembler, so the code is fragile when flags are changed
> from what we developers use. Allowing CFLAGS to be modified would be
> giving users a loaded gun. :-)
>
> -- Keir
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xen-devel
>
>


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
Jerome Brown wrote on 15/11/2004 23:19:
> No, I do not have those lines in my Rules.mk file. It was downloaded
> this morning using the ebuild, so was the xen-2.0.tgz file from
> sourceforge. If I add -nopie to the CFLAGS in Rules.mk file xen will
> compile fine, however if I add -nopie to my environment CFLAGS it does
> not get picked up by the xen build script. Therefore I can compile and
> install it, but it takes manual intervention, which defeats the idea of
> using an ebuild :)

Have you tried it with the updated ebuild (by SpanKY) at
http://bugs.gentoo.org/attachment.cgi?id=43893 ? I'm not completely sure
what it actually does, but it looks a bit like it alters CFLAGS in
Rules.mk and a few other Makefiles to pick up the environment's CFLAGS:
sed -i \
-e "/CFLAGS/s:-O3:${CFLAGS}:" \
tools/libx{c,util}/Makefile \
tools/misc/{miniterm,nsplitd}/Makefile \
tools/{misc,xentrace}/Makefile \
xen/arch/x86/Rules.mk || die "sed cflags"

--
Philip Taylor
philip@zaynar.demon.co.uk


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
Thats solves the problem (I can tell just looking at it!)

To the xen-devels - is this a fair way to go about it (manually editing
the Rules.mk to import CFLAGS) or is there a better way to go about it?

Cheers

Jerome

Philip Taylor wrote:
> Jerome Brown wrote on 15/11/2004 23:19:
>
>> No, I do not have those lines in my Rules.mk file. It was downloaded
>> this morning using the ebuild, so was the xen-2.0.tgz file from
>> sourceforge. If I add -nopie to the CFLAGS in Rules.mk file xen will
>> compile fine, however if I add -nopie to my environment CFLAGS it does
>> not get picked up by the xen build script. Therefore I can compile and
>> install it, but it takes manual intervention, which defeats the idea
>> of using an ebuild :)
>
>
> Have you tried it with the updated ebuild (by SpanKY) at
> http://bugs.gentoo.org/attachment.cgi?id=43893 ? I'm not completely sure
> what it actually does, but it looks a bit like it alters CFLAGS in
> Rules.mk and a few other Makefiles to pick up the environment's CFLAGS:
> sed -i \
> -e "/CFLAGS/s:-O3:${CFLAGS}:" \
> tools/libx{c,util}/Makefile \
> tools/misc/{miniterm,nsplitd}/Makefile \
> tools/{misc,xentrace}/Makefile \
> xen/arch/x86/Rules.mk || die "sed cflags"
>


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
> Thats solves the problem (I can tell just looking at it!)
>
> To the xen-devels - is this a fair way to go about it (manually editing
> the Rules.mk to import CFLAGS) or is there a better way to go about it?

The unstable tree now includes Makefile fixes to work correctly with
PIE/SSP-enabled GCC. No manual CFLAGS fixing will be required.

-- Keir


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
Is there plans to create a patch that can be applied to the stable 2.0
tree to allow this?

Cheers

Jerome

Keir Fraser wrote:
>>Thats solves the problem (I can tell just looking at it!)
>>
>>To the xen-devels - is this a fair way to go about it (manually editing
>>the Rules.mk to import CFLAGS) or is there a better way to go about it?
>
>
> The unstable tree now includes Makefile fixes to work correctly with
> PIE/SSP-enabled GCC. No manual CFLAGS fixing will be required.
>
> -- Keir
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xen-devel
>
>


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
I'll port it across to 2.0.

-- Keir

> Is there plans to create a patch that can be applied to the stable 2.0
> tree to allow this?
>
> Cheers
>
> Jerome
>
> Keir Fraser wrote:
> >>Thats solves the problem (I can tell just looking at it!)
> >>
> >>To the xen-devels - is this a fair way to go about it (manually editing
> >>the Rules.mk to import CFLAGS) or is there a better way to go about it?
> >
> >
> > The unstable tree now includes Makefile fixes to work correctly with
> > PIE/SSP-enabled GCC. No manual CFLAGS fixing will be required.
> >
> > -- Keir
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: InterSystems CACHE
> > FREE OODBMS DOWNLOAD - A multidimensional database that combines
> > robust object and relational technologies, making it a perfect match
> > for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/xen-devel
> >
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xen-devel



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
> > > I am attempting to install Xen-2.0 using the Gentoo Ebuilds written by
> > > Philip Taylor, and have run into the same problem as A Streecar Named
> > > with needing to implement the -nopie flag.
> >
> > strange, I didn't have to do it (using ebuilds from
> > http://bugs.gentoo.org/show_bug.cgi?id=70161)
>
> Yes, I did wonder about this.
>
> Can you take a look in xen/arch/x86/Rules.mk and see if you have the
> lines:
> # Disable PIE/SSP if GCC supports them. They can break us.
> CFLAGS += $(call test-gcc-flag,-nopie)
> CFLAGS += $(call test-gcc-flag,-fno-stack-protector)
> CFLAGS += $(call test-gcc-flag,-fno-stack-protector-all)
>
> If so then you have a *very* up-to-date tree. :-) I recently checked
> in a build fix that would disable PIE/SSP iff they are supported by
> GCC.
>
> If not then I'm confused!

No, I can't seen anything like that.

zirafa ~ # gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs
Configured with: /var/tmp/portage/gcc-3.3.4-r1/work/gcc-3.3.4/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3
--includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared
--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib
--enable-languages=c,c++ --enable-threads=posix --enable-long-long
--disable-checking --disable-libunwind-exceptions--enable-cstdio=stdio
--enable-version-specific-runtime-libs
--with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3
--with-local-prefix=/usr/local --enable-shared --enable-nls
--without-included-gettext --disable-multilib --enable-__cxa_atexit
--enable-clocale=generic
Thread model: posix
gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
zirafa ~ # ebuild /usr/local/portage/sys-apps/xen/xen-2.0.ebuild unpack
zirafa ~ # cat /var/tmp/portage/xen-2.0/work/xen-2.0/xen/arch/x86/Rules.mk
########################################
# x86-specific definitions

CC := gcc
LD := ld

CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
CFLAGS += -iwithprefix include -Wall -Werror -pipe
CFLAGS += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls

ifeq ($(optimize),y)
CFLAGS += -O3 -march=pentium2 -pipe -fomit-frame-pointer
else
x86_32/usercopy.o: CFLAGS += -O1
endif


# Prevent floating-point variables from creeping into Xen.
CFLAGS += -msoft-float

ifeq ($(TARGET_SUBARCH),x86_32)
CFLAGS += -m32 -march=i686
LDFLAGS := --oformat elf32-i386
endif

ifeq ($(TARGET_SUBARCH),x86_64)
CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
CFLAGS += -fno-asynchronous-unwind-tables
LDFLAGS := --oformat elf64-x86-64
endif





-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
On Tue, 16 Nov 2004 22:32:55 +0100, Jan Kundrát <jan.kundrat@fzu.cz> wrote:
> CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
> CFLAGS += -iwithprefix include -Wall -Werror -pipe
> CFLAGS += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls
>
> ifeq ($(optimize),y)
> CFLAGS += -O3 -march=pentium2 -pipe -fomit-frame-pointer

It looks like the ebuild changed the last line above to that (I assume
your CFLAGS env variable is -O3 -march=pentium2 -pipe). I didn't use
the ebuild, so I had the default line of CFLAGS += -O3
-fomit-frame-pointer, and found that I had to add -nopie and
-fno-stack-protector to compile xen.

Perhaps -march=pentium2 fixed it for you? Or perhaps those were just
somethings special I had to do on the crusoe?!?


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
The modified ebuild on bugs.gentoo.org has a sed command to update the
Rules.mk file to inherit the cflags that you set in make.conf

Is all go now (YAY!)

Jerome

A Streetcar Named wrote:
> On Tue, 16 Nov 2004 22:32:55 +0100, Jan Kundrát <jan.kundrat@fzu.cz> wrote:
>
>>CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
>>CFLAGS += -iwithprefix include -Wall -Werror -pipe
>>CFLAGS += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls
>>
>>ifeq ($(optimize),y)
>>CFLAGS += -O3 -march=pentium2 -pipe -fomit-frame-pointer
>
>
> It looks like the ebuild changed the last line above to that (I assume
> your CFLAGS env variable is -O3 -march=pentium2 -pipe). I didn't use
> the ebuild, so I had the default line of CFLAGS += -O3
> -fomit-frame-pointer, and found that I had to add -nopie and
> -fno-stack-protector to compile xen.
>
> Perhaps -march=pentium2 fixed it for you? Or perhaps those were just
> somethings special I had to do on the crusoe?!?
>
>



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Re: Inheriting CFLAGS [ In reply to ]
> > CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
> > CFLAGS += -iwithprefix include -Wall -Werror -pipe
> > CFLAGS += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls
> >
> > ifeq ($(optimize),y)
> > CFLAGS += -O3 -march=pentium2 -pipe -fomit-frame-pointer
>
> It looks like the ebuild changed the last line above to that (I assume
> your CFLAGS env variable is -O3 -march=pentium2 -pipe). I didn't use
> the ebuild, so I had the default line of CFLAGS += -O3
> -fomit-frame-pointer, and found that I had to add -nopie and
> -fno-stack-protector to compile xen.

maybe, there's some sed stuff in the ebuild

> Perhaps -march=pentium2 fixed it for you? Or perhaps those were just
> somethings special I had to do on the crusoe?!?

who knows ;-)

j.



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel