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

Weiming Zhao weimingz at codeaurora.org
Fri Jul 20 09:57:19 PDT 2012


Hi Jordan,

Sorry, my bad. I posted the wrong patch, which was for LLVM 3.1

My current change is based on the master branch, which is a little more
complex to do than the original literal declaration of va_list. 
I'm attaching the patch for master now. I'll update the bugzilla as well.

Unfortunately, I still need to deal with the copy-constructor assertion.

Thanks,
Weiming


-----Original Message-----
From: Jordan Rose [mailto:jordan_rose at apple.com] 
Sent: Thursday, July 19, 2012 6:12 PM
To: Weiming Zhao
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] Bug 11709 Fix: va_list on ARM is not following
AAPCS 7.1.4

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_aa
> pcs.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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Bug-11709-Change-the-definition-of-va_list-to-meet-A.patch
Type: application/octet-stream
Size: 6749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120720/2da36406/attachment.obj>


More information about the cfe-commits mailing list