Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Build a file with -m32



Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:

> Any advice on how I could modify the amd64 kernel build so that a 
> given file is built with -m32?

This seems to be the way forward (thanks Christos)

COPTS.multiboot2_32.c=  -m32 -mcmodel=32 -msoft-float -mno-mmx \
    -mno-sse -mno-avx

But then we lack some 32 bit stuff on amd64:

In file included from /home2/manu/src/sys/sys/stdint.h:97:0,
                 from /home2/manu/src/sys/sys/inttypes.h:39,
                 from /home2/manu/src/sys/sys/param.h:104,
                 from
/home2/manu/src/sys/arch/x86/x86/multiboot2_32.c:38:
./machine/int_const.h:64:10: fatal error: i386/int_const.h: No such file
or directory


I created the link to src/sys/arch/i386/include manually, then:

In file included from ./machine/param.h:133:0,
                 from /home2/manu/src/sys/sys/param.h:173,
                 from
/home2/manu/src/sys/arch/x86/x86/multiboot2_32.c:38:
./i386/param.h:81:10: fatal error: opt_kernbase.h: No such file or
directory

An empty opt_kernbase.h was enough to pass that one. Third problem, at
link time:

/home2/manu/src/obj/tooldir.NetBSD-8.1-amd64/bin/x86_64--netbsd-ld: i386
architecture of input file `multiboot2_32.o' is incompatible with
i386:x86-64 output

That one is more serious. I tried removing multiboot2_32.o from ld
command line, and add it in the kernel linker script in a dedicated
section:
        .text32 : {
                multiboot2_32.o(.text)
        }

That does not help:

/home2/manu/src/obj/tooldir.NetBSD-8.1-amd64/bin/x86_64--netbsd-ld:
skipping incompatible multiboot2_32.o when searching for multiboot2_32.o
/home2/manu/src/obj/tooldir.NetBSD-8.1-amd64/bin/x86_64--netbsd-ld:
cannot find multiboot2_32.o

I also tried wrapping that section with TARGET(elf32-i386) and
TARGET(elf64-x86-64) but that only produces syntax errors.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index