Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Remove need for ARM EABI/OABI difference in va_list handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain Buclaw committed Aug 30, 2012
1 parent 03e34f8 commit fc61260
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 77 deletions.
4 changes: 3 additions & 1 deletion gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
2012-08-30 Iain Buclaw <ibuclaw@ubuntu.com>

* d-lang.cc(d_init): Remove 'Thumb' identifier for ARM as 16bit
platforms aren't supported. Add ARM_EABI identifier.
platforms aren't supported.
(GNU_LongDouble128): Remove identifier as long double size is
determined from type information.

* d-decls.cc(TypeInfoDeclaration::toSymbol): Mark all typeinfo decls
as 'used'.
Expand Down
10 changes: 0 additions & 10 deletions gcc/d/d-lang.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,6 @@ d_init (void)
VersionCondition::addPredefinedGlobalIdent (D_VENDOR_VERSYM);
#endif

#ifdef TARGET_ARM
if (TARGET_AAPCS_BASED)
VersionCondition::addPredefinedGlobalIdent("ARM_EABI");
#endif

if (BYTES_BIG_ENDIAN)
VersionCondition::addPredefinedGlobalIdent ("BigEndian");
else
Expand All @@ -274,11 +269,6 @@ d_init (void)
if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ)
VersionCondition::addPredefinedGlobalIdent ("GNU_SjLj_Exceptions");

#ifdef TARGET_LONG_DOUBLE_128
if (TARGET_LONG_DOUBLE_128)
VersionCondition::addPredefinedGlobalIdent ("GNU_LongDouble128");
#endif

#ifdef STACK_GROWS_DOWNWARD
VersionCondition::addPredefinedGlobalIdent ("GNU_StackGrowsDown");
#endif
Expand Down
30 changes: 5 additions & 25 deletions libphobos/libdruntime/core/stdc/stdarg.d
Original file line number Diff line number Diff line change
Expand Up @@ -184,32 +184,12 @@ version( GNU )
}
else version( ARM )
{
version( ARM_EABI )
{
// Layout of this struct must match __gnuc_va_list for C ABI compatibility
struct __va_list
{
void* ptr;
}

void va_arg()(ref va_list apx, TypeInfo ti, void* parmn)
{
__va_list* ap = cast(__va_list*)apx;
auto p = ap.ptr;
auto tsize = ti.tsize();
ap.ptr = cast(va_list)( cast(void*) p + ( ( tsize + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
parmn[0..tsize] = p[0..tsize];
}
}
else
void va_arg()(ref va_list ap, TypeInfo ti, void* parmn)
{
void va_arg()(ref va_list ap, TypeInfo ti, void* parmn)
{
auto p = ap;
auto tsize = ti.tsize();
ap = cast(va_list)( cast(void*) p + ( ( tsize + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
parmn[0..tsize] = p[0..tsize];
}
auto p = *cast(void**) &ap;
auto tsize = ti.tsize();
*cast(void**) &ap += ( tsize + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 );
parmn[0..tsize] = p[0..tsize];
}
}
else
Expand Down
47 changes: 6 additions & 41 deletions libphobos/std/format.d
Original file line number Diff line number Diff line change
Expand Up @@ -4668,14 +4668,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version(ARM)
{
version(ARM_EABI)
{
__va_list va;
va.ptr = p;
argptr = cast(va_list) va;
}
else
argptr = p;
*cast(void**) &argptr = p;
}
else
{
Expand Down Expand Up @@ -4733,13 +4726,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version (ARM)
{
version (ARM_EABI)
{ __va_list va;
va.ptr = pkey;
argptr = cast(va_list) va;
}
else
argptr = cast(va_list) pkey;
*cast(void**) &argptr = pkey;
}
else
{
Expand All @@ -4764,13 +4751,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version (ARM)
{
version (ARM_EABI)
{ __va_list va2;
va.ptr = pvalue;
argptr = cast(va_list) va2;
}
else
argptr = cast(va_list) pvalue;
*cast(void**) &argptr = pvalue;
}
else
{
Expand Down Expand Up @@ -4929,12 +4910,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
else version (X86_64)
putArray((cast(__va_list*)argptr).stack_args, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
else version (ARM)
{
version (ARM_EABI)
putArray((cast(__va_list)argptr).ptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
else
putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
}
putArray(*cast(void**) &argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
else
{
static if (is(va_list == void*))
Expand Down Expand Up @@ -5069,19 +5045,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version (ARM)
{
void* p;
version (ARM_EABI)
{
auto talign = tis.talign();
__va_list* ap = cast(__va_list*)&argptr;
p = ap.ptr;
ap.ptr += (tis.tsize() + size_t.sizeof - 1) & ~(size_t.sizeof - 1);
}
else
{
p = argptr;
argptr += (tis.tsize() + size_t.sizeof - 1) & ~(size_t.sizeof - 1);
}
void* p = *cast(void**) &argptr;
*cast(void**) &argptr += (tis.tsize() + size_t.sizeof - 1) & ~(size_t.sizeof - 1);
s = tis.xtoString(p);
}
else
Expand Down

0 comments on commit fc61260

Please sign in to comment.