<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>129491</bug_id>
          
          <creation_ts>2006-04-10 08:51 0000</creation_ts>
          <short_desc>app-emulation/xen-tools-3.0.2 emerge failed with hardened profile</short_desc>
          <delta_ts>2006-04-16 09:39:36 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>TEST-REQUEST</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>langthang@gentoo.org</reporter>
          <assigned_to>chrb@gentoo.org</assigned_to>
          <cc>hardened@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>langthang@gentoo.org</who>
            <bug_when>2006-04-10 08:51:22 0000</bug_when>
            <thetext>gcc  -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -DTEXTADDR=0x000D0000 -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -D__ASSEMBLY__ -DDEBUG -DTEXTADDR=0x000D0000 -c trap.S
cpp -P -DDEBUG -DTEXTADDR=0x000D0000 vmxassist.ld &gt; vmxassist.tmp
ld -o vmxassist -m elf_i386 -nostdlib --fatal-warnings -N -T vmxassist.tmp head.o trap.o vm86.o setup.o util.o
vm86.o: In function `address&apos;:
vm86.c:(.text+0x19): undefined reference to `__guard&apos;
vm86.c:(.text+0x51): undefined reference to `__stack_smash_handler&apos;
vm86.c:(.text+0x8e): undefined reference to `__guard&apos;
vm86.o: In function `trace&apos;:
vm86.c:(.text+0x189): undefined reference to `__guard&apos;
vm86.c:(.text+0x1d4): undefined reference to `__guard&apos;
vm86.c:(.text+0x1f0): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `getreg32&apos;:
vm86.c:(.text+0x2fa): undefined reference to `__guard&apos;
vm86.o: In function `.L32&apos;:
vm86.c:(.text+0x338): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `setreg32&apos;:
vm86.c:(.text+0x39e): undefined reference to `__guard&apos;
vm86.o: In function `.L44&apos;:
vm86.c:(.text+0x3d8): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `sib&apos;:
vm86.c:(.text+0x42b): undefined reference to `__guard&apos;
vm86.c:(.text+0x484): undefined reference to `__guard&apos;
vm86.c:(.text+0x4a3): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `operand&apos;:
vm86.c:(.text+0x56a): undefined reference to `__guard&apos;
vm86.c:(.text+0x6ad): undefined reference to `__stack_smash_handler&apos;
vm86.c:(.text+0x700): undefined reference to `__guard&apos;
vm86.c:(.text+0x70b): undefined reference to `__guard&apos;
vm86.o: In function `.L139&apos;:
vm86.c:(.text+0x764): undefined reference to `__guard&apos;
vm86.o: In function `.L138&apos;:
vm86.c:(.text+0x78e): undefined reference to `__guard&apos;
vm86.o: In function `movr&apos;:
vm86.c:(.text+0x93b): undefined reference to `__guard&apos;
vm86.o:vm86.c:(.text+0x9c0): more undefined references to `__guard&apos; follow
vm86.o: In function `movr&apos;:
vm86.c:(.text+0x9e0): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `load_seg&apos;:
vm86.c:(.text+0xd4b): undefined reference to `__guard&apos;
vm86.c:(.text+0xda1): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `set_mode&apos;:
vm86.c:(.text+0xf19): undefined reference to `__guard&apos;
vm86.c:(.text+0xf74): undefined reference to `__guard&apos;
vm86.c:(.text+0xf94): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `interrupt&apos;:
vm86.c:(.text+0x139d): undefined reference to `__guard&apos;
vm86.c:(.text+0x1478): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `outbyte&apos;:
vm86.c:(.text+0x14a9): undefined reference to `__guard&apos;
vm86.c:(.text+0x14e8): undefined reference to `__stack_smash_handler&apos;
vm86.c:(.text+0x1537): undefined reference to `__guard&apos;
vm86.o: In function `inbyte&apos;:
vm86.c:(.text+0x1619): undefined reference to `__guard&apos;
vm86.c:(.text+0x1654): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `emulate&apos;:
vm86.c:(.text+0x16b9): undefined reference to `__guard&apos;
vm86.o: In function `.L321&apos;:
vm86.c:(.text+0x1795): undefined reference to `__guard&apos;
vm86.c:(.text+0x17b5): undefined reference to `__stack_smash_handler&apos;
vm86.o: In function `trap&apos;:
vm86.c:(.text+0x2619): undefined reference to `__guard&apos;
vm86.c:(.text+0x264a): undefined reference to `__guard&apos;
vm86.c:(.text+0x2666): undefined reference to `__stack_smash_handler&apos;
vm86.c:(.text+0x26bc): undefined reference to `__guard&apos;
setup.o: In function `banner&apos;:
setup.c:(.text+0x16): undefined reference to `__guard&apos;
setup.c:(.text+0x113): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `setup_gdt&apos;:
setup.c:(.text+0x14b): undefined reference to `__guard&apos;
setup.c:(.text+0x226): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `set_intr_gate&apos;:
setup.c:(.text+0x259): undefined reference to `__guard&apos;
setup.c:(.text+0x2b6): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `setup_idt&apos;:
setup.c:(.text+0x2e8): undefined reference to `__guard&apos;
setup.c:(.text+0x31e): undefined reference to `__guard&apos;
setup.c:(.text+0x33a): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `setup_pic&apos;:
setup.c:(.text+0x369): undefined reference to `__guard&apos;
setup.c:(.text+0x3d3): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `setiomap&apos;:
setup.c:(.text+0x409): undefined reference to `__guard&apos;
setup.c:(.text+0x449): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `enter_real_mode&apos;:
setup.c:(.text+0x478): undefined reference to `__guard&apos;
setup.c:(.text+0x573): undefined reference to `__guard&apos;
setup.c:(.text+0x58f): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `setup_ctx&apos;:
setup.c:(.text+0x5fb): undefined reference to `__guard&apos;
setup.c:(.text+0x795): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `start_bios&apos;:
setup.c:(.text+0x7c4): undefined reference to `__guard&apos;
setup.c:(.text+0x80f): undefined reference to `__guard&apos;
setup.c:(.text+0x82b): undefined reference to `__stack_smash_handler&apos;
setup.o: In function `main&apos;:
setup.c:(.text+0x879): undefined reference to `__guard&apos;
setup.c:(.text+0x8d4): undefined reference to `__stack_smash_handler&apos;
util.o: In function `putchar&apos;:
util.c:(.text+0x19): undefined reference to `__guard&apos;
util.c:(.text+0x3f): undefined reference to `__stack_smash_handler&apos;
util.o: In function `strlen&apos;:
util.c:(.text+0x68): undefined reference to `__guard&apos;
util.c:(.text+0xa5): undefined reference to `__stack_smash_handler&apos;
util.o: In function `printnum&apos;:
util.c:(.text+0xcb): undefined reference to `__guard&apos;
util.c:(.text+0x118): undefined reference to `__stack_smash_handler&apos;
util.o: In function `_doprint&apos;:
util.c:(.text+0x15b): undefined reference to `__guard&apos;
util.c:(.text+0x2b4): undefined reference to `__guard&apos;
util.c:(.text+0x2d4): undefined reference to `__stack_smash_handler&apos;
util.o: In function `panic&apos;:
util.c:(.text+0x409): undefined reference to `__guard&apos;
util.c:(.text+0x44f): undefined reference to `__stack_smash_handler&apos;
util.o: In function `vprintf&apos;:
util.c:(.text+0x479): undefined reference to `__guard&apos;
util.c:(.text+0x4b0): undefined reference to `__stack_smash_handler&apos;
util.o: In function `printf&apos;:
util.c:(.text+0x4d9): undefined reference to `__guard&apos;
util.c:(.text+0x510): undefined reference to `__stack_smash_handler&apos;
util.o: In function `dump_dtr&apos;:
util.c:(.text+0x536): undefined reference to `__guard&apos;
util.c:(.text+0x5f9): undefined reference to `__guard&apos;
util.c:(.text+0x615): undefined reference to `__stack_smash_handler&apos;
util.o: In function `dump_vmx_context&apos;:
util.c:(.text+0x649): undefined reference to `__guard&apos;
util.c:(.text+0xbc9): undefined reference to `__stack_smash_handler&apos;
util.o: In function `print_e820_map&apos;:
util.c:(.text+0xbf9): undefined reference to `__guard&apos;
util.c:(.text+0xce2): undefined reference to `__guard&apos;
util.c:(.text+0xcfe): undefined reference to `__stack_smash_handler&apos;
util.o: In function `hexdump&apos;:
util.c:(.text+0xd46): undefined reference to `__guard&apos;
util.c:(.text+0xe8e): undefined reference to `__guard&apos;
util.c:(.text+0xeaa): undefined reference to `__stack_smash_handler&apos;
util.o: In function `dump_regs&apos;:
util.c:(.text+0xed8): undefined reference to `__guard&apos;
util.c:(.text+0x1005): undefined reference to `__guard&apos;
util.c:(.text+0x1021): undefined reference to `__stack_smash_handler&apos;
util.o: In function `memset&apos;:
util.c:(.text+0x1059): undefined reference to `__guard&apos;
util.c:(.text+0x1091): undefined reference to `__stack_smash_handler&apos;
util.o: In function `memcpy&apos;:
util.c:(.text+0x10c9): undefined reference to `__guard&apos;
util.c:(.text+0x1113): undefined reference to `__stack_smash_handler&apos;
make[2]: *** [vmxassist.bin] Error 1
make[2]: Leaving directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools/firmware/vmxassist&apos;
make[1]: *** [all] Error 2
make[1]: Leaving directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools/firmware&apos;
make: *** [all] Error 2
make: Leaving directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools&apos;

!!! ERROR: app-emulation/xen-tools-3.0.2 failed.
Call stack:
  ebuild.sh, line 1532:   Called dyn_compile
  ebuild.sh, line 929:   Called src_compile
  xen-tools-3.0.2.ebuild, line 69:   Called die

!!! compile failed
!!! If you need support, post the topmost build error, and the call stack if relevant.

mail xen-tools # emerge info
Portage 2.1_pre7-r5 (hardened/x86/2.6, gcc-3.4.6, glibc-2.3.6-r3, 2.6.16-rc5-xen i686)
=================================================================
System uname: 2.6.16-rc5-xen i686 Intel(R) Pentium(R) 4 CPU 1.80GHz
Gentoo Base System version 1.12.0_pre16
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.4.2-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS=&quot;x86 ~x86&quot;
AUTOCLEAN=&quot;yes&quot;
CBUILD=&quot;i686-pc-linux-gnu&quot;
CFLAGS=&quot;-O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse&quot;
CHOST=&quot;i686-pc-linux-gnu&quot;
CONFIG_PROTECT=&quot;/etc /etc/mail/dspam /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control /var/run/dspam&quot;
CONFIG_PROTECT_MASK=&quot;/etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/env.d&quot;
CXXFLAGS=&quot;-O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
FEATURES=&quot;autoconfig distlocks metadata-transfer noinfo parallel-fetch sandbox sfperms strict userpriv usersandbox&quot;
GENTOO_MIRRORS=&quot;http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo&quot;
LANG=&quot;en_US.utf8&quot;
LINGUAS=&quot;en_US vi&quot;
MAKEOPTS=&quot;-j2&quot;
PKGDIR=&quot;/usr/portage//packages/x86/&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR=&quot;/usr/portage/&quot;
PORTDIR_OVERLAY=&quot;/usr/portage/overlay&quot;
SYNC=&quot;rsync://rsync.gentoo.org/gentoo-portage&quot;
USE=&quot;apache2 berkdb bzip2 crypt dlloader hardened ithreads mysql nls pam pic readline sasl ssl tcpd unicode userlocales utf8 vhosts x86 zlib elibc_glibc kernel_linux linguas_en_US linguas_vi userland_GNU&quot;
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS


If I set gcc to i686-pc-linux-gnu-3.4.6-vanilla, xen-tools-3.0.2 emerge fine.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>chrb@gentoo.org</who>
            <bug_when>2006-04-10 11:12:51 0000</bug_when>
            <thetext>The xen Makefiles try to filter CFLAGS building different parts of the source  with the function:

test-gcc-flag = $(shell $(1) -v --help 2&gt;&amp;1 | grep -q &quot; $(2) &quot; &amp;&amp; echo $(2))

calls are like:

./xen/arch/x86/Rules.mk:CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
./xen/arch/x86/Rules.mk:CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
./xen/arch/x86/Rules.mk:CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
./tools/ioemu/target-i386-dm/Makefile:SSE2 := $(call test-gcc-flag,$(CC),-msse2)

$ gcc --help -v 2&gt;&amp;1|grep sse2
  -mno-sse2                 Do not support MMX, SSE and SSE2 built-in functions and code generation
  -msse2                    Support MMX, SSE and SSE2 built-in functions and code generation

$ gcc --help -v 2&gt;&amp;1|grep pie
gcc version 3.4.6 (Gentoo 3.4.6, ssp-3.4.5-1.0, pie-8.7.9)
  -fpie                       Generate position-independent code for
  -pie, --pic-executable      Create a position independent executable

So the question is - why does gcc on Gentoo not show these -no* options in it&apos;s help for the hardened flags, when apparently other distros do?
 
You could obviously filter the flags for all the built software, like the old ebuilds did, but that kind of negates the point of running hardened - only vmxassist and hvmloader need non-hardened flags.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>chrb@gentoo.org</who>
            <bug_when>2006-04-10 11:57:48 0000</bug_when>
            <thetext>I&apos;ve tried to fix the problem by just adding the -nopie -no-stack* flags to the hvmloader and vmxassist Makefiles. Let me know if it works.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>langthang@gentoo.org</who>
            <bug_when>2006-04-10 12:16:45 0000</bug_when>
            <thetext>(In reply to comment #1)
&gt; The xen Makefiles try to filter CFLAGS building different parts of the source 
&gt; with the function:
&gt; 
&gt; test-gcc-flag = $(shell $(1) -v --help 2&gt;&amp;1 | grep -q &quot; $(2) &quot; &amp;&amp; echo $(2))
&gt; 
&gt; calls are like:
&gt; 
&gt; ./xen/arch/x86/Rules.mk:CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
&gt; ./xen/arch/x86/Rules.mk:CFLAGS  += $(call
&gt; test-gcc-flag,$(CC),-fno-stack-protector)
&gt; ./xen/arch/x86/Rules.mk:CFLAGS  += $(call
&gt; test-gcc-flag,$(CC),-fno-stack-protector-all)
&gt; ./tools/ioemu/target-i386-dm/Makefile:SSE2 := $(call
&gt; test-gcc-flag,$(CC),-msse2)
&gt; 
&gt; $ gcc --help -v 2&gt;&amp;1|grep sse2
&gt;   -mno-sse2                 Do not support MMX, SSE and SSE2 built-in functions
&gt; and code generation
&gt;   -msse2                    Support MMX, SSE and SSE2 built-in functions and
&gt; code generation
&gt; 
&gt; $ gcc --help -v 2&gt;&amp;1|grep pie
&gt; gcc version 3.4.6 (Gentoo 3.4.6, ssp-3.4.5-1.0, pie-8.7.9)
&gt;   -fpie                       Generate position-independent code for
&gt;   -pie, --pic-executable      Create a position independent executable
&gt; 
&gt; So the question is - why does gcc on Gentoo not show these -no* options in it&apos;s
&gt; help for the hardened flags, when apparently other distros do?
&gt; 
&gt; You could obviously filter the flags for all the built software, like the old
&gt; ebuilds did, but that kind of negates the point of running hardened - only
&gt; vmxassist and hvmloader need non-hardened flags.
&gt; 

there are couple problem with the way they test for PIE/SSP.
1. if CFLAGS is unset, the test failed to detect gcc. I have to have USE=custom-cflags to buils xen-tools
2. with xen-tools-3.0.2, they unset CFLAGS in the tools/firmware/{hvmloader,vmxassist}Makefile which causes test-gcc-flag failed to detect hardened gcc .

my workaround similar to your, but I just commented the &quot;CFLAGS :=&quot; line

sed -i -e &apos;s/CFLAGS :=/# CFLAGS :=/g&apos; &quot;${S}/tools/firmware/hvmloader/Makefile&quot; &quot;${S}/tools/firmware/vmxassist/Makefile&quot;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>chrb@gentoo.org</who>
            <bug_when>2006-04-10 12:42:46 0000</bug_when>
            <thetext>It isn&apos;t the unset of CFLAGS that causes the failed gcc detect, it&apos;s the fact that under Gentoo &apos;gcc -v --help&apos; doesn&apos;t show the nopie and no-stack-protector flags. Their code apparently works fine on other distributions.

If you just comment out the CFLAG := in the Makefiles, where do your -nopie no-stack-protector flags come from? They must be set somewhere for vmxassist to build?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>langthang@gentoo.org</who>
            <bug_when>2006-04-10 13:47:09 0000</bug_when>
            <thetext>I wasn&apos;t clear in my last comment, I meant it failed to detect gentoo gcc.
Why unset CFLAGS cause it failed I don&apos;t know (yet), but commented that line put &quot;-nopie -fno-stack-protector&quot;  back in there as you can see below. I differed the Makefile from the older version and notice the new &quot;CFLAGS :=&quot; line

make[2]: Entering directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools/firmware/vmxassist&apos;
i686-pc-linux-gnu-gcc -O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse -nopie -fno-stack-protector -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -DTEXTADDR=0x000D0000 -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -D__ASSEMBLY__ -DDEBUG -DTEXTADDR=0x000D0000 -c head.S
gcc -Wall -Werror -Wstrict-prototypes   -Wdeclaration-after-statement -I. -I../../../tools/libxc -o gen gen.c
i686-pc-linux-gnu-gcc -O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse -nopie -fno-stack-protector -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -DTEXTADDR=0x000D0000 -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -c vm86.c
i686-pc-linux-gnu-gcc -O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse -nopie -fno-stack-protector -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -DTEXTADDR=0x000D0000 -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -c setup.c
i686-pc-linux-gnu-gcc -O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse -nopie -fno-stack-protector -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -DTEXTADDR=0x000D0000 -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -c util.c
./gen &gt; offsets.h
i686-pc-linux-gnu-gcc -O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse -nopie -fno-stack-protector -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -DTEXTADDR=0x000D0000 -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -D__ASSEMBLY__ -DDEBUG -DTEXTADDR=0x000D0000 -c trap.S
cpp -P -DDEBUG -DTEXTADDR=0x000D0000 vmxassist.ld &gt; vmxassist.tmp
ld -o vmxassist -m elf_i386 -nostdlib --fatal-warnings -N -T vmxassist.tmp head.o trap.o vm86.o setup.o util.o
nm -n vmxassist &gt; vmxassist.sym
objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0 vmxassist vmxassist.tmp
dd if=vmxassist.tmp of=vmxassist.bin ibs=512 conv=sync
36+0 records in
36+0 records out
18432 bytes (18 kB) copied, 0.000756 seconds, 24.4 MB/s
rm -f vmxassist.tmp
make[2]: Leaving directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools/firmware/vmxassist&apos;
make[2]: Entering directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools/firmware/hvmloader&apos;
./mkhex rombios ../rombios/BIOS-bochs-latest &gt; roms.h
./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin &gt;&gt; roms.h
./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin &gt;&gt; roms.h
./mkhex vmxassist ../vmxassist/vmxassist.bin &gt;&gt; roms.h
./mkhex acpi ../acpi/acpi.bin &gt;&gt; roms.h
i686-pc-linux-gnu-gcc -O2 -march=pentium4 -fomit-frame-pointer -fforce-addr -mmmx -msse -msse2 -mfpmath=sse -nopie -fno-stack-protector -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement  -D__XEN_INTERFACE_VERSION__=0x00030101 -DNDEBUG -m32  -Wall -Wstrict-prototypes -Wdeclaration-after-statement     -DDEBUG -I. -I../../../tools/libxc -fno-builtin -O2 -msoft-float -c hvmloader.c acpi_madt.c
i686-pc-linux-gnu-gcc -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,0x100000 -o hvmloader.tmp hvmloader.o acpi_madt.o
objcopy hvmloader.tmp hvmloader
rm -f hvmloader.tmp
make[2]: Leaving directory `/var/tmp/portage/xen-tools-3.0.2/work/xen-3.0.2/tools/firmware/hvmloader&apos;

As for why `test-gcc-flag = $(shell $(1) -v --help 2&gt;&amp;1 | grep -q &quot; $(2) &quot; &amp;&amp; echo $(2))` doesn&apos;t turn up any of &quot;-nopie&quot;, &quot;-fno-stack-protector&quot;, and &quot;-fno-stack-protector-all&quot; , may be the hardened team can tell.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>langthang@gentoo.org</who>
            <bug_when>2006-04-10 17:09:58 0000</bug_when>
            <thetext>my bad. thosee &quot;-nopie -fno-stack-protector&quot; came from
...
        if use custom-cflags; then
               filter-flags -fPIE -fstack-protector
        else
...
and I have USE=custom-cflags

the new ebuild pass this stage but failed at vga.c and you are already known about it.

Using this patch http://lists.xensource.com/archives/html/xen-changelog/2006-04/msg00108.html I was be able to emerge xen-tools-3.0.2 on hardened profile.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>langthang@gentoo.org</who>
            <bug_when>2006-04-10 17:11:47 0000</bug_when>
            <thetext>sorry to spam. I forgot to mention that hardened USE flag is missing in IUSE.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>chrb@gentoo.org</who>
            <bug_when>2006-04-11 03:27:08 0000</bug_when>
            <thetext>It&apos;s not spam if it&apos;s a bug :)

I&apos;ve added the patch and fixed IUSE.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>solar@gentoo.org</who>
            <bug_when>2006-04-16 09:39:36 0000</bug_when>
            <thetext>I was able to compile xen-tools while using a hardened profile</thetext>
          </long_desc>
      
    </bug>

</bugzilla>