Hi,
This patch updates the AArch64 port to mangle __va_list as it is in
namespace std in C++. This is specified in the AArch64 AAPCS64 ABI doc.
OK for the trunk?
Thanks,
Yufeng
gcc/ChangeLog
2012-11-21 Yufeng Zhang <yufeng.zh...@arm.com>
* config/aarch64/aarch64.c (aarch64_mangle_type): New function.
(TARGET_MANGLE_TYPE): Define.
gcc/testsuite/ChangeLog
2012-11-21 Yufeng Zhang <yufeng.zh...@arm.com>
* g++.dg/abi/arm_va_list.C: Also test on aarch64*-*-*.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 4437fef..792b086 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5859,6 +5859,20 @@ aarch64_preferred_simd_mode (enum machine_mode mode)
return word_mode;
}
+/* Implement TARGET_MANGLE_TYPE. */
+
+const char *
+aarch64_mangle_type (const_tree type)
+{
+ /* The AArch64 ABI documents say that "__va_list" has to be
+ managled as if it is in the "std" namespace. */
+ if (lang_hooks.types_compatible_p (CONST_CAST_TREE (type), va_list_type))
+ return "St9__va_list";
+
+ /* Use the default mangling. */
+ return NULL;
+}
+
/* Legitimize a memory reference for sync primitive implemented using
LDXR/STXR instructions. We currently force the form of the reference
to be indirect without offset. */
@@ -6923,6 +6937,9 @@ aarch64_c_mode_for_suffix (char suffix)
#undef TARGET_LIBGCC_CMP_RETURN_MODE
#define TARGET_LIBGCC_CMP_RETURN_MODE aarch64_libgcc_cmp_return_mode
+#undef TARGET_MANGLE_TYPE
+#define TARGET_MANGLE_TYPE aarch64_mangle_type
+
#undef TARGET_MEMORY_MOVE_COST
#define TARGET_MEMORY_MOVE_COST aarch64_memory_move_cost
diff --git a/gcc/testsuite/g++.dg/abi/arm_va_list.C b/gcc/testsuite/g++.dg/abi/arm_va_list.C
index 45a426a..d983ee1 100644
--- a/gcc/testsuite/g++.dg/abi/arm_va_list.C
+++ b/gcc/testsuite/g++.dg/abi/arm_va_list.C
@@ -1,9 +1,10 @@
-// { dg-do compile }
+// { dg-do compile { target { aarch64*-*-* arm*-*-* } } }
// { dg-options "-Wno-abi" }
-// { dg-require-effective-target arm_eabi }
+// { dg-require-effective-target arm_eabi { target arm*-*-* } }
// AAPCS \S 7.1.4 requires that va_list be a typedef for "struct
// __va_list". The mangling is as if it were "std::__va_list".
+// So is required for the AArch64 target.
// #include <stdarg.h>
typedef __builtin_va_list va_list;