Explicitly check for linking format to use for efiemu64 module

Similar to check for target linking format, also check for efiemu64
instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
variants. We cannot easily reuse main target check because platforms
are different (main target is 32 bit and efiemu64 - 64 bit).

This commit adds EFIEMU64_LINK_FORMAT that contains detected
link option and is used in efiemu64.o linking instead of hardcoded
value.

Reported-By: Beeblebrox <zaphod@berentweb.com>
This commit is contained in:
Andrey Borzenkov 2013-11-24 21:12:17 +04:00
parent bee1b5ce3f
commit c2b70d0981
2 changed files with 32 additions and 7 deletions

View file

@ -398,8 +398,9 @@ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
fi
# Link format -arch,x86_64 means Apple linker
efiemu64_c.o: efiemu/runtime/efiemu.c
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
else \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
@ -407,7 +408,7 @@ efiemu64_c.o: efiemu/runtime/efiemu.c
efiemu64_s.o: efiemu/runtime/efiemu.S
-rm -f $@
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
else \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
@ -415,14 +416,13 @@ efiemu64_s.o: efiemu/runtime/efiemu.S
efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
-rm -f $@; \
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
rm -f $@.bin; \
$(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
$(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
rm -f $@.bin; \
else \
$(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
$(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^ || exit 1; \
fi
platform_DATA += efiemu32.o efiemu64.o