[SeaBIOS] [PATCH v2] ld: don't hardcode "-melf_i386"
Idwer Vollering
vidwer at gmail.com
Wed Apr 16 14:38:45 CEST 2014
2014-04-16 9:14 GMT+02:00 Roger Pau Monne <roger.pau at citrix.com>:
> On FreeBSD, the name of the emulation is "-melf_i386_fbsd", so allow
> SeaBIOS to fetch the emulation to use from the environment variables.
>
> This allows SeaBIOS to compile on FreeBSD with gcc.
> +LD32BIT_FLAG:=-melf_i386
That will not work, see below for proof.
With your patch applied, on FreeBSD 10.0-RELEASE and gcc 4.7.3
installed from ports:
> Building ld scripts
> ./scripts/buildversion.sh out/version.c
> Version: rel-1.7.4-86-g028f348-dirty-20140416_140430-machete
> gcc -Iout/ -Isrc -Os -MD -g -Wall -Wno-strict-aliasing -Wold-style-definition -Wtype-limits -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 -minline-all-stringops -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks -ffunction-sections -fdata-sections -fno-common -fno-stack-protector -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer -c out/version.c -o out/version.o
> ld -melf_i386 -r out/ccode32flat.o out/version.o -o out/code32flat.o
> ld: unrecognised emulation mode: elf_i386
> Supported emulations: elf_x86_64_fbsd elf_i386_fbsd
> gmake: *** [out/romlayout16.lds] Error 1
With 'LD32BIT_FLAG:=-melf_i386_fbsd':
> Building ld scripts
> ./scripts/buildversion.sh out/version.c
> Version: rel-1.7.4-86-g028f348-dirty-20140416_140652-machete
> gcc -Iout/ -Isrc -Os -MD -g -Wall -Wno-strict-aliasing -Wold-style-definition -Wtype-limits -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 -minline-all-stringops -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks -ffunction-sections -fdata-sections -fno-common -fno-stack-protector -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer -c out/version.c -o out/version.o
> ld -melf_i386_fbsd -r out/ccode32flat.o out/version.o -o out/code32flat.o
> ld -melf_i386_fbsd -r out/ccode16.o out/romlayout.o -o out/code16.o
And:
> $ gcc47 -dumpspecs | grep elf_i386
> %{!static:--eh-frame-hdr} %{m32:-m elf_i386_fbsd} %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} %{v:-V} %{assert*} %{R*} %{rpath*} %{defsym*} %{shared:-Bshareable %{h*} %{soname*}} %{!shared: %{!static: %{rdynamic:-export-dynamic} -dynamic-linker %(fbsd_dynamic_linker) } %{static:-Bstatic}} %{symbolic:-Bsymbolic}
More information about the SeaBIOS
mailing list