https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89093
--- Comment #52 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
I digged a bit, and found a D syntax for the target attribute,
it is a bit of a complication since D does not have a pre-processor,
but an empty target attribute does seem to be ignored without warnings.
--- libphobos/libdruntime/gcc/deh.d 2019-01-01 13:31:55.000000000 +0100
+++ libphobos/libdruntime/gcc/deh.d 2019-04-17 11:24:24.171579381 +0200
@@ -28,6 +28,7 @@ import gcc.unwind;
import gcc.unwind.pe;
import gcc.builtins;
import gcc.config;
+import gcc.attribute;
extern(C)
{
@@ -519,10 +520,19 @@ extern(C) void _d_throw(Throwable object
terminate("unwind error", __LINE__);
}
+static if (GNU_ARM_EABI_Unwinder)
+{
+ enum TARGET_ATTRIBUTE = "general-regs-only";
+}
+else
+{
+ enum TARGET_ATTRIBUTE = "";
+}
/**
* Read and extract information from the LSDA (.gcc_except_table section).
*/
+@attribute("target", (TARGET_ATTRIBUTE))
_Unwind_Reason_Code scanLSDA(const(ubyte)* lsda, _Unwind_Exception_Class
exceptionClass,
_Unwind_Action actions, _Unwind_Exception*
unwindHeader,
_Unwind_Context* context, _Unwind_Word cfa,
@@ -772,6 +782,7 @@ int actionTableLookup(_Unwind_Action act
* Called when the personality function has found neither a cleanup or
handler.
* To support ARM EABI personality routines, that must also unwind the stack.
*/
+@attribute("target", (TARGET_ATTRIBUTE))
_Unwind_Reason_Code CONTINUE_UNWINDING(_Unwind_Exception* unwindHeader,
_Unwind_Context* context)
{
static if (GNU_ARM_EABI_Unwinder)
@@ -814,6 +825,7 @@ else
static if (GNU_ARM_EABI_Unwinder)
{
pragma(mangle, PERSONALITY_FUNCTION)
+ @attribute("target", (TARGET_ATTRIBUTE))
extern(C) _Unwind_Reason_Code gdc_personality(_Unwind_State state,
_Unwind_Exception*
unwindHeader,
_Unwind_Context* context)
@@ -873,6 +885,7 @@ else
}
}
+@attribute("target", (TARGET_ATTRIBUTE))
private _Unwind_Reason_Code __gdc_personality(_Unwind_Action actions,
_Unwind_Exception_Class
exceptionClass,
_Unwind_Exception* unwindHeader,