diff mbox

[AARCH64] Fix the name mangling of va_list

Message ID 50B77EB5.1070209@arm.com
State New
Headers show

Commit Message

Yufeng Zhang Nov. 29, 2012, 3:26 p.m. UTC
Please find the updated patch that improves the comment added to the 
test in the generic part of the testsuite.

Thanks,
Yufeng

On 11/26/12 09:55, Marcus Shawcroft wrote:
> On 21/11/12 14:31, Yufeng Zhang wrote:
>> 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.zhang@arm.com>
>>
>>            * config/aarch64/aarch64.c (aarch64_mangle_type): New function.
>>            (TARGET_MANGLE_TYPE): Define.
>>
>
> The change to the AArch64 port itself is OK.
>
>> gcc/testsuite/ChangeLog
>>
>> 2012-11-21  Yufeng Zhang<yufeng.zhang@arm.com>
>>
>>            * g++.dg/abi/arm_va_list.C: Also test on aarch64*-*-*.
>>
>
>    // 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.
>
>
> The functional change in this test makes sense however the comment
> change is slightly confusing.  The original comment refers to the
> procedure call standard for AArch32: IHI0042D_aapcs.pdf.
>
> The procedure call standard for AArch64 is defined in
> IHI0055A_aapcs.pdf.  This document also discusses va_list in chapter
> 7.1.4.  Perhaps a different form of words distinguishes between the two
> different PCS documents would be better? Perhaps something along these
> lines:
>
> // 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".
> // AArch64 PCS IHI0055A_aapcs64.pdf \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".
>
> In any case I don;t believe I can OK this change to the generic part of
> the test suite. Suggest you CC Mike Stump or Janis Johnson.
>
>
> Cheers
>
> /Marcus
>

Comments

Marcus Shawcroft Dec. 4, 2012, 3:23 p.m. UTC | #1
On 29 November 2012 15:26, Yufeng Zhang <Yufeng.Zhang@arm.com> wrote:
> Please find the updated patch that improves the comment added to the test in
> the generic part of the testsuite.

OK
/Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index d4708bf..42f3a40 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5853,6 +5853,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;
+}
+
 /* Return the equivalent letter for size.  */
 static unsigned char
 sizetochar (int size)
@@ -6778,6 +6792,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..4f6f3a4 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".
+// AAPCS64 \S 7.1.4 has the same requirement for AArch64 targets.
 // #include <stdarg.h>
 typedef __builtin_va_list va_list;