/usr/include/d/ldc/eh_asm.S is in libphobos2-ldc-dev 1:0.17.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | /**
* Exception handling support code that is best written in assembly
* goes here.
*
* Copyright: Copyright The LDC Developers 2016
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
*/
/*
* Mark the resulting object file as not requiring execution
* permissions on stack memory. The absence of this section would mark
* the whole resulting library as requiring an executable stack,
* making it impossible to dynamically load druntime on several Linux
* platforms where this is forbidden due to security policies.
*/
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
.previous
#endif
/*
* Called by our compiler-generate code to resume unwinding after a
* finally block (or dtor destruction block) has been run. 'ptr' (r0)
* is to a _d_exception.
*
* void _d_eh_resume_unwind(void* ptr)
*
* _Unwind_Resume for ARM_EABI expects registers not to be clobbered
* by our cleanup routine, so need this wrapper to preserve scratch
* registers (7.4 [6 Note]) before entering it.
*
* Note: Current codegen of D catch landing pads are incompatible with
* GCC provided _Unwind_Resume because the LLVM inliner can create
* landing pads that advertise to catch more exceptions than are
* handled, falling into _d_eh_resume_unwind to find the real handler.
* _Unwind_Resume ignores the saved IP and resets it to the original
* call site in this frame, but we need the callsite of
* _d_eh_resume_unwind to find the next landing pad. Workaround is to
* capture it, passing to _d_arm_eabi_end_cleanup as second arg.
*/
#ifdef __ARM_EABI__
// say we will preseve 8-byte stack when we push
.eabi_attribute 25, 1
.text
.global _d_eh_resume_unwind
.align 2
_d_eh_resume_unwind:
push {r1-r3,lr} // end_cleanup may trash these
mov r1,lr // callsite IP
bl _d_arm_eabi_end_cleanup
pop {r1-r3,lr} // restore regs to state at entry
b _Unwind_Resume // r0 has returned ucb
#endif //__ARM_EABI
|