[v3][patch] ARM EABI tweaks for vector constructors
Paul Brook
paul@codesourcery.com
Thu Aug 12 13:23:00 GMT 2004
The ARM EABI says that __cxa_vec_ctor and __cxa_vec_cctor should return their
first argument. Patch below implements this.
Built i686-linux and Tested with cross to arm-none-elf.
Ok?
Paul
2004-08-12 Paul Brook <paul@codesourcery.com>
* config/arm/cpu/cxxabi_tweaks.h: Define __cxa_vec_ctor_return and
_GLIBCXX_CXA_VEC_CTOR_RETURN.
* config/cpu/generic/cxxabi_tweaks.h: Ditto.
* libsupc++/cxxabi.h (__cxa_vec_ctor, __cxa_vec_cctor): Use
__cxa_vec_ctor_return.
* libsupc++/vec.cc (__cxa_vec_ctor, __cxa_vec_cctor): Ditto.
Use _GLIBCXX_CXA_VEC_CTOR_RETURN.
* g++.dg/abi/arm_cxa_vec_1.C: New test.
Index: libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h
===================================================================
RCS
file: /var/cvsroot/gcc-cvs/gcc/libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h,v
retrieving revision 1.2
diff -u -p -r1.2 cxxabi_tweaks.h
--- libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h 4 Aug 2004 21:13:16 -0000 1.2
+++ libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h 12 Aug 2004 13:03:53 -0000
@@ -45,12 +45,22 @@ namespace __cxxabiv1
// We also want the element size in array cookies.
#define _GLIBCXX_ELTSIZE_IN_COOKIE 1
-#else
+ // __cxa_vec_ctor should return a pointer to the array.
+ typedef void * __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return x
+
+#else // __ARM_EABI__
+
// The generic ABI uses the first byte of a 64-bit guard variable.
#define _GLIBCXX_GUARD_ACQUIRE(x) (!*(char *) (x))
#define _GLIBCXX_GUARD_RELEASE(x) *(char *) (x) = 1
__extension__ typedef int __guard __attribute__((mode (__DI__)));
-#endif
+
+ // __cxa_vec_ctor has void return type.
+ typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+
+#endif //!__ARM_EABI__
#ifdef __cplusplus
} // namespace __cxxabiv1
Index: libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h
===================================================================
RCS
file: /var/cvsroot/gcc-cvs/gcc/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h,v
retrieving revision 1.1
diff -u -p -r1.1 cxxabi_tweaks.h
--- libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h 2 Jul 2004 23:58:41 -0000
1.1
+++ libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h 11 Aug 2004 20:01:30 -0000
@@ -40,6 +40,10 @@ namespace __cxxabiv1
#define _GLIBCXX_GUARD_RELEASE(x) *(char *) (x) = 1
__extension__ typedef int __guard __attribute__((mode (__DI__)));
+ // __cxa_vec_ctor has void return type.
+ typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+
#ifdef __cplusplus
} // namespace __cxxabiv1
#endif
Index: libstdc++-v3/libsupc++/cxxabi.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/libstdc++-v3/libsupc++/cxxabi.h,v
retrieving revision 1.19
diff -u -p -r1.19 cxxabi.h
--- libstdc++-v3/libsupc++/cxxabi.h 3 Aug 2004 06:45:54 -0000 1.19
+++ libstdc++-v3/libsupc++/cxxabi.h 12 Aug 2004 13:09:30 -0000
@@ -73,12 +73,12 @@ namespace __cxxabiv1
void (*__dealloc) (void*, size_t));
// Construct array.
- void
+ __cxa_vec_ctor_return_type
__cxa_vec_ctor(void* __array_address, size_t __element_count,
size_t __element_size, void (*__constructor) (void*),
void (*__destructor) (void*));
- void
+ __cxa_vec_ctor_return_type
__cxa_vec_cctor(void* dest_array, void* src_array, size_t element_count,
size_t element_size, void (*constructor) (void*, void*),
void (*destructor) (void*));
Index: libstdc++-v3/libsupc++/vec.cc
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/libstdc++-v3/libsupc++/vec.cc,v
retrieving revision 1.16
diff -u -p -r1.16 vec.cc
--- libstdc++-v3/libsupc++/vec.cc 2 Jul 2004 23:40:16 -0000 1.16
+++ libstdc++-v3/libsupc++/vec.cc 12 Aug 2004 12:46:42 -0000
@@ -155,7 +155,7 @@ namespace __cxxabiv1
}
// Construct array.
- extern "C" void
+ extern "C" __cxa_vec_ctor_return_type
__cxa_vec_ctor(void *array_address,
std::size_t element_count,
std::size_t element_size,
@@ -179,10 +179,11 @@ namespace __cxxabiv1
}
__throw_exception_again;
}
+ _GLIBCXX_CXA_VEC_CTOR_RETURN (array_address);
}
// Construct an array by copying.
- extern "C" void
+ extern "C" __cxa_vec_ctor_return_type
__cxa_vec_cctor(void *dest_array,
void *src_array,
std::size_t element_count,
@@ -209,6 +210,7 @@ namespace __cxxabiv1
}
__throw_exception_again;
}
+ _GLIBCXX_CXA_VEC_CTOR_RETURN (dest_array);
}
// Destruct array.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm_cxa_vec1.C
Type: text/x-c++src
Size: 505 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040812/cb9a3cb4/attachment.bin>
More information about the Libstdc++
mailing list