Commit c45108f0 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1596656 - Move OBJCOPY to python configure. r=firefox-build-system-reviewers,andi

As a bonus, we also check and prefer llvm-objcopy when it's suitable.

Differential Revision: https://phabricator.services.mozilla.com/D136975
parent a6f796c8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ AC_CHECK_PROGS(LIPO, "${TOOLCHAIN_PREFIX}lipo", :)
AC_CHECK_PROGS(STRIP, "${TOOLCHAIN_PREFIX}strip", :)
AC_CHECK_PROGS(OTOOL, "${TOOLCHAIN_PREFIX}otool", :)
AC_CHECK_PROGS(INSTALL_NAME_TOOL, "${TOOLCHAIN_PREFIX}install_name_tool", :)
AC_CHECK_PROGS(OBJCOPY, "${TOOLCHAIN_PREFIX}objcopy", :)
PATH=$_SAVE_PATH
])

+27 −1
Original line number Diff line number Diff line
@@ -827,12 +827,38 @@ def readelf_when(compile_env, target, host):
check_prog(
    "READELF",
    readelf,
    what="readelf",
    when=readelf_when,
    paths=clang_search_path,
    validate=validate_readelf,
)


@depends(llvm_tool("llvm-objcopy"), toolchain_prefix)
def objcopy(llvm_objcopy, toolchain_prefix):
    commands = [llvm_objcopy[0], "objcopy"]
    for prefix in toolchain_prefix or ():
        commands.insert(1, "%sreadelf" % prefix)
    return tuple(commands)


def validate_objcopy(path):
    if "llvm-objcopy" not in path:
        return True
    # llvm-objcopy doesn't support --only-keep-debug before llvm 9.0.
    retcode, stdout, stderr = get_cmd_output(path, "--help")
    return retcode == 0 and any(
        l.startswith("  --only-keep-debug ") for l in stdout.splitlines()
    )


check_prog(
    "OBJCOPY",
    objcopy,
    when=readelf_when,
    paths=clang_search_path,
    validate=validate_objcopy,
)

option("--enable-dtrace", help="Build with dtrace support")

dtrace = check_header(
+0 −10
Original line number Diff line number Diff line
@@ -63,16 +63,6 @@ if test "$COMPILE_ENVIRONMENT"; then
    MOZ_ANDROID_NDK
fi # COMPILE_ENVIRONMENT

case "$target" in
*-android*|*-linuxandroid*)
    ;;
*-linux*)
    AC_PATH_PROG(OBJCOPY,objcopy)
    ;;
esac

AC_SUBST(OBJCOPY)

dnl ========================================================
dnl Checks for compilers.
dnl ========================================================