Subject: Re: building 32bit binaries
To: None <port-xen@netbsd.org>
From: Christoph Egger <Christoph_Egger@gmx.de>
List: port-amd64
Date: 10/22/2007 15:38:42
On Friday 19 October 2007 16:53:31 Christoph Egger wrote:
> Hi!
>
> I'm about making xen-tools buildable on NetBSD/amd64.
>
> The build currently stops at building the Xen firmware that is used
> to run HVM guests.
>
> [...]
> gmake[3]: Entering directory `xen-unstable.hg/tools/firmware/rombios/32bit'
> getconf: LFS_CFLAGS: unknown variable
> gmake[4]: Entering directory
> `xen-unstable.hg/tools/firmware/rombios/32bit/tcgbios'
> gcc -m32 -march=i686 -DNDEBUG -fno-strict-aliasing -std=gnu99 -Wall
> -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement
> -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -mno-tls-direct-seg-refs -fno-builtin -O2 -msoft-float -nostdlib
> -fno-stack-protector -I../ -I../../ -DGCC_PROTOS -c -o tcgbios.o tcgbios.c
> tcgbios.c: In function 'tcpa_add_measurement':
> tcgbios.c:595: warning: pointer targets in passing argument 3
> of 'tcpa_add_measurement_to_log_simple' differ in signedness
> gmake[3]: Entering directory `xen-unstable.hg/xen/arch/x86'
> gcc -O2 -fomit-frame-pointer -m64 -DNDEBUG -fno-strict-aliasing -std=gnu99
> -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement
> -nostdinc -fno-builtin -fno-common -iwithprefix include -Werror
> -Wno-pointer-arith -pipe -Ixen-unstable.hg/xen/include
> -Ixen-unstable.hg/xen/include/asm-x86/mach-generic
> -Ixen-unstable.hg/xen/include/asm-x86/mach-default -msoft-float
> -fno-stack-protector -mno-red-zone -fpic -fno-reorder-blocks
> -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__
> -S -o asm-offsets.s x86_64/asm-offsets.c
> gmake[3]: Leaving directory `xen-unstable.hg/xen/arch/x86'
> gmake -f xen-unstable.hg/xen/Rules.mk include/asm-x86/asm-offsets.h
> ld -melf_i386 -r tcgbios.o tpm_drivers.o -o tcgbiosext.o
> ld: cannot open linker script file ldscripts/elf_i386.xr: No such file or
> directory
> gmake[4]: *** [tcgbiosext.o] Error 1
> gmake[4]: Leaving directory
> `xen-unstable.hg/tools/firmware/rombios/32bit/tcgbios'
> gmake[3]: *** [subdirs] Error 2
> gmake[3]: Leaving directory `xen-unstable.hg/tools/firmware/rombios/32bit'
> gmake[2]: *** [all] Error 2
> gmake[2]: Leaving directory `xen-unstable.hg/tools/firmware'
> gmake[1]: *** [install] Error 2
> gmake[1]: Leaving directory `xen-unstable.hg/tools'
> gmake: *** [install-tools] Error 2
>
>
> I could work around this by copying elf_i386.xr from a NetBSD/i386
> installation into /usr/share/ldscripts/.
>
> Can someone add elf_i386.xr to the standard distribution of NetBSD/amd64,
> please?
> This should allow building 32bit binaries on NetBSD/amd64 out of the box.
I discovered another issue related to compiling 32bit binaries.
When a .c file
#include <stdint.h>
it always gets the amd64 type definition.
gcc -m32 option #define's __i386__. So it is possible to always get
the correct type definition either from /usr/include/i386
or /usr/include/amd64 depending on if gcc is called with -m32 or -m64
(-m64 is the default).
Christoph