IBT/BTI instructions and D compilers

Ernesto Castellotti erny.castell at gmail.com
Mon Jul 10 13:08:03 UTC 2023


On Monday, 10 July 2023 at 13:01:46 UTC, Brian Callahan wrote:
> On Monday, 10 July 2023 at 12:46:57 UTC, Ernesto Castellotti 
> wrote:
>> On Monday, 10 July 2023 at 11:24:37 UTC, Brian Callahan wrote:
>>> Hi all (but probably mostly Walter) --
>>>
>>> OpenBSD has moved to an all-BTI world. Binaries produced by 
>>> DMD and LDC no longer work because of this. If other OSes 
>>> make this move, this problem will be further compounded. Is 
>>> there any thought about enabling IBT/BTI instructions in DMD 
>>> and LDC?
>>>
>>> Thanks.
>>
>> BTI should work on GCC D Compiler (GDC) with 
>> -branch-protection=bti, LDC as far as I know lacks flag 
>> support but it should be very easy to implement because LLVM 
>> supports BTI.
>> Regarding DMD I think it's very complex because probably the 
>> backend doesn't support it.
>
> AFAIK, it does work on GDC.


Yes I tried now, no problem with -fcf-protection and 
-mbranch-protection in GDC.

For LDC it should be very simple to do the same, it would be 
useful to open an issue in the LDC repo

The real problem is DMD, I'm afraid it needs some tweaking in the 
backend


More information about the Digitalmars-d mailing list