Commit d44935cb authored by Diego Biurrun's avatar Diego Biurrun Committed by James Almer

build: Explicitly set 32-bit/64-bit object formats for nasm/yasm

Consistently use object format names with "32" suffix and set object format
to "win64" on Windows x86_64, which fixes assembling with nasm.

(Cherry-picked from libav commit 808ef435)
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 0cc0c5b6
...@@ -3254,7 +3254,6 @@ doxygen_default="doxygen" ...@@ -3254,7 +3254,6 @@ doxygen_default="doxygen"
install="install" install="install"
ln_s_default="ln -s -f" ln_s_default="ln -s -f"
nm_default="nm -g" nm_default="nm -g"
objformat="elf"
pkg_config_default=pkg-config pkg_config_default=pkg-config
ranlib_default="ranlib" ranlib_default="ranlib"
strip_default="strip" strip_default="strip"
...@@ -4797,6 +4796,8 @@ esac ...@@ -4797,6 +4796,8 @@ esac
enable $subarch enable $subarch
enabled spic && enable_weak pic enabled spic && enable_weak pic
enabled x86_64 && objformat=elf64 || objformat="elf32"
# OS specific # OS specific
case $target_os in case $target_os in
aix) aix)
...@@ -4867,7 +4868,7 @@ case $target_os in ...@@ -4867,7 +4868,7 @@ case $target_os in
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
objformat="macho" objformat="macho"
enabled x86_64 && objformat="macho64" enabled x86_64 && objformat="macho64" || objformat="macho32"
enabled_any pic shared x86_64 || enabled_any pic shared x86_64 ||
{ check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; } { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
check_header dispatch/dispatch.h && check_header dispatch/dispatch.h &&
...@@ -4911,7 +4912,7 @@ case $target_os in ...@@ -4911,7 +4912,7 @@ case $target_os in
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--disable-auto-image-base' SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--disable-auto-image-base'
objformat="win32" enabled x86_64 && objformat="win64" || objformat="win32"
ranlib=: ranlib=:
enable dos_paths enable dos_paths
check_ldflags -Wl,--nxcompat,--dynamicbase check_ldflags -Wl,--nxcompat,--dynamicbase
...@@ -4951,7 +4952,7 @@ case $target_os in ...@@ -4951,7 +4952,7 @@ case $target_os in
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
objformat="win32" enabled x86_64 && objformat="win64" || objformat="win32"
ranlib=: ranlib=:
enable dos_paths enable dos_paths
;; ;;
...@@ -4966,7 +4967,7 @@ case $target_os in ...@@ -4966,7 +4967,7 @@ case $target_os in
SLIB_INSTALL_LINKS= SLIB_INSTALL_LINKS=
SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a' SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
objformat="win32" enabled x86_64 && objformat="win64" || objformat="win32"
enable dos_paths enable dos_paths
enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
...@@ -5377,7 +5378,8 @@ EOF ...@@ -5377,7 +5378,8 @@ EOF
EOF EOF
# llvm's integrated assembler supports .object_arch from llvm 3.5 # llvm's integrated assembler supports .object_arch from llvm 3.5
[ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
check_as <<EOF && enable as_object_arch
.object_arch armv4 .object_arch armv4
EOF EOF
...@@ -5490,22 +5492,15 @@ EOF ...@@ -5490,22 +5492,15 @@ EOF
if ! disabled_any asm mmx x86asm; then if ! disabled_any asm mmx x86asm; then
if check_cmd $x86asmexe --version; then if check_cmd $x86asmexe --version; then
enabled x86_64 && x86asm_extra="-m amd64"
x86asm_debug="-g dwarf2" x86asm_debug="-g dwarf2"
X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)' X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
elif check_cmd nasm -v; then elif check_cmd nasm -v; then
x86asmexe=nasm x86asmexe=nasm
x86asm_debug="-g -F dwarf" x86asm_debug="-g -F dwarf"
X86ASM_DEPFLAGS='-MD $(@:.o=.d)' X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
if enabled x86_64; then
case "$objformat" in
elf) objformat=elf64 ;;
win32) objformat=win64 ;;
esac
fi
fi fi
X86ASMFLAGS="-f $objformat $x86asm_extra" X86ASMFLAGS="-f $objformat"
enabled pic && append X86ASMFLAGS "-DPIC" enabled pic && append X86ASMFLAGS "-DPIC"
test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX" test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
case "$objformat" in case "$objformat" in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment