Skip to content

Commit b8f5222

Browse files
committed
asm/arm-xlate.pl: recognize -mbranch-protection.
1 parent 3841209 commit b8f5222

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

src/asm/arm-xlate.pl

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@
330330
} if ($flavour =~ /ios64/);
331331

332332
my $paciasp = sub {
333-
($flavour =~ /linux|cheri/) ? "\t.inst\t0xd503233f"
334-
: &$inst(0xd503233f);
333+
($flavour =~ /linux|cheri/) ? "\thint\t#PACI_HINT"
334+
: "\thint\t#25";
335335
};
336336

337337
my $autiasp = sub {
338-
($flavour =~ /linux|cheri/) ? "\t.inst\t0xd50323bf"
339-
: &$inst(0xd50323bf);
338+
($flavour =~ /linux|cheri/) ? "\thint\t#AUTI_HINT"
339+
: "\thint\t#29";
340340
};
341341

342342
sub range {
@@ -400,6 +400,17 @@ sub expand_line {
400400
print<<___;
401401
GBLA __SIZEOF_POINTER__
402402
__SIZEOF_POINTER__ SETA $1/8
403+
___
404+
} elsif ($flavour =~ /linux|cheri/) {
405+
print<<___;
406+
#if defined(__ARM_FEATURE_PAC_DEFAULT) && __ARM_FEATURE_PAC_DEFAULT==2
407+
# define PACI_HINT 27
408+
# define AUTI_HINT 31
409+
#else
410+
# define PACI_HINT 25
411+
# define AUTI_HINT 29
412+
#endif
413+
403414
___
404415
}
405416

@@ -474,6 +485,22 @@ sub expand_line {
474485
print "\n";
475486
}
476487

477-
print "\tEND\n" if ($flavour =~ /win/);
488+
if ($flavour =~ /win/) {
489+
print "\tEND\n";
490+
} elsif ($flavour =~ /linux|cheri/) {
491+
# -mbranch-protection=standanrd segment, snatched from compiler -S output
492+
print <<___;
493+
494+
#if defined(__ARM_FEATURE_BTI_DEFAULT) || defined(__ARM_FEATURE_PAC_DEFAULT)
495+
.section .note.GNU-stack,"",\@progbits
496+
.section .note.gnu.property,"a",\@note
497+
.long 4,2f-1f,5
498+
.byte 0x47,0x4E,0x55,0
499+
1: .long 0xc0000000,4,3
500+
.align 3
501+
2:
502+
#endif
503+
___
504+
}
478505

479506
close STDOUT;

0 commit comments

Comments
 (0)