提交 1bc02f1c 编写于 作者: Z zhuoli

Add 64bit support for musl

Signed-off-by: Nzhuoli <pengzhuoli@huawei.com>
上级 713e746b
......@@ -153,6 +153,7 @@ action("copy_uapi") {
script = "scripts/copy_uapi.sh"
args = [ "-i" ] + [ rebase_path("${uapi_dir}") ]
args += [ "-o" ] + [ rebase_path("${target_out_dir}/${musl_inc_out_dir}") ]
args += [ "-t" ] + [ "${musl_arch}" ]
}
copy("musl_copy_inc_bits") {
......
......@@ -1595,9 +1595,6 @@ if (musl_arch == "arm") {
"arch/generic/bits/dirent.h",
"arch/generic/bits/errno.h",
"arch/generic/bits/fcntl.h",
"arch/generic/bits/fenv.h",
"arch/generic/bits/hwcap.h",
"arch/generic/bits/ioctl_fix.h",
"arch/generic/bits/ioctl.h",
"arch/generic/bits/io.h",
......
......@@ -92,25 +92,27 @@ template("musl_libs") {
]
config("${abi_prefix}_musl_abi_config") {
if (target_abi == "soft") {
cflags = [ "-mfloat-abi=soft" ]
} else if (target_abi == "a7_soft") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=soft",
]
} else if (target_abi == "a7_softfp_neon-vfpv4") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=softfp",
"-mfpu=neon-vfpv4",
]
} else if (target_abi == "a7_hard_neon-vfpv4") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=hard",
"-mfpu=neon-vfpv4",
]
if (musl_arch == "arm") {
if (target_abi == "soft") {
cflags = [ "-mfloat-abi=soft" ]
} else if (target_abi == "a7_soft") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=soft",
]
} else if (target_abi == "a7_softfp_neon-vfpv4") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=softfp",
"-mfpu=neon-vfpv4",
]
} else if (target_abi == "a7_hard_neon-vfpv4") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=hard",
"-mfpu=neon-vfpv4",
]
}
}
}
......@@ -128,12 +130,17 @@ template("musl_libs") {
cflags_basic = [
"--target=${musl_target_triple}",
"-march=armv7-a",
"-Wall",
"-D_FORTIFY_SOURCE=2",
"-Wl,-z,relro,-z,now,-z,noexecstack",
]
if (musl_arch == "arm") {
cflags_basic += [ "-march=armv7-a", ]
} else if (musl_arch == "aarch64") {
cflags_basic += [ "-march=armv8", ]
}
cflags_auto = [
"-D_XOPEN_SOURCE=700",
"-g",
......@@ -220,9 +227,14 @@ template("musl_libs") {
"src/env/__init_tls.c",
"src/env/__libc_start_main.c",
"src/env/__stack_chk_fail.c",
"src/thread/${musl_arch}/__set_thread_area.c",
]
if (musl_arch == "arm") {
sources_orig -= [ "src/thread/${musl_arch}/__set_thread_area.c" ]
} else if (musl_arch == "aarch64") {
sources_orig -= [ "src/thread/${musl_arch}/__set_thread_area.s" ]
}
if ("${target_abi}" == "a7_hard_neon-vfpv4") {
defines = [ "__ARM_PCS_VFP" ]
}
......@@ -251,9 +263,14 @@ template("musl_libs") {
"src/env/__init_tls.c",
"src/env/__libc_start_main.c",
"src/env/__stack_chk_fail.c",
"src/thread/${musl_arch}/__set_thread_area.c",
]
if (musl_arch == "arm") {
sources_orig += [ "src/thread/${musl_arch}/__set_thread_area.c" ]
} else if (musl_arch == "aarch64") {
sources_orig += [ "src/thread/${musl_arch}/__set_thread_area.s" ]
}
foreach(s, sources_orig) {
sources += [ "${target_out_dir}/${musl_ported_dir}/${s}" ]
}
......@@ -385,6 +402,8 @@ template("musl_libs") {
":${abi_prefix}_musl_ldso",
":${abi_prefix}_musl_src",
":${abi_prefix}_musl_src_nossp",
":${abi_prefix}_libdl",
":${abi_prefix}_libpthread",
]
}
......
while getopts "o:i:h" arg
while getopts "o:i:t:h" arg
do
case "${arg}" in
"o")
......@@ -8,6 +8,9 @@ do
"i")
SOURCE_DIR=${OPTARG}
;;
"t")
TARGET_ARCH=${OPTARG}
;;
"h")
echo "help"
;;
......@@ -22,6 +25,14 @@ if [ ! -d "${OUT_DIR}" ];then
mkdir -p ${OUT_DIR}
fi
cp -r ${SOURCE_DIR}/* ${OUT_DIR}
rm -rf ${OUT_DIR}/asm-arm
if [ ${TARGET_ARCH} = "arm" ]; then
mv ${OUT_DIR}/asm-arm/asm ${OUT_DIR}/asm
rm -rf ${OUT_DIR}/asm-arm64
rm -rf ${OUT_DIR}/asm-arm
elif [ ${TARGET_ARCH} = "aarch64" ]; then
mv ${OUT_DIR}/asm-arm64/asm ${OUT_DIR}/asm
rm -rf ${OUT_DIR}/asm-arm64
rm -rf ${OUT_DIR}/asm-arm
fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册