[cfe-commits] Bug 11709 Fix: va_list on ARM is not following AAPCS 7.1.4

Jordan Rose jordan_rose at apple.com
Thu Jul 19 18:11:31 PDT 2012


Hi, Weiming. This patch is stale; va_list is now defined by ASTContext (see ASTContext.cpp). I'm not sure if the copy-constructor assertion will still be a problem using the new implementation.

Thanks for catching this problem, though. Are you willing to rewrite it using the current handling of va_list?
Jordan


On Jul 19, 2012, at 4:00 PM, Weiming Zhao wrote:

> Hello,
>  
> ARM AAPCS ABI Section 7.1.4 (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf)
> specifies that va_list should be defined as 
> struct __va_list {
> void *__ap;
> }
> And in C++, __va_list is in namespace std.
>  
> However, LLVM defined it as "void *__ap", which generates different mangled name for C++ code.
>  
> For example:
> For the following c++ code:
>  
> #include <stdarg.h>
> int bar(int a, va_list args)
> {
> }
>  
> It should generate the name "_Z3bariSt9__va_list" (GCC 4.4 does that correctly).
> But now, it generates "_Z3bariPv".
>  
> Therefore, there is linkage issues between LLVM and other toolchains that follow the ABI spec. 
>  
> I attached the fix and test case. (uploaded to http://llvm.org/bugs/show_bug.cgi?id=11709 as well).
> It passes the test suite. For the unit test, no new fails. (the before/after test report is attached).
>  
> One thing I’m very certain is the change in lib/AST/ExprClassification.cpp. Without that change, in debug build, the assertion will be triggered. 
> So I relax the condition to let __va_list to pass the check. Please let me know if there is a better solution.
>  
> Please review the patch.
>  
> Thanks,
> Weiming
>  
>  
>  
> <0001-change-definiation-of-va_list-to-meet-arm-abi.patch><test-suite-report_after.log><unit_test_after.log><unit_test_before.log>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list