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,
./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,
./i386/param.h:81:10: fatal error: opt_kernbase.h: No such file or

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
        .text32 : {

That does not help:

skipping incompatible multiboot2_32.o when searching for multiboot2_32.o
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

Home | Main Index | Thread Index | Old Index