Fix IBT/BTI by instrumenting function calls

This commit is contained in:
Tobias Heider 2023-12-03 17:32:20 +01:00 committed by Quentin Carbonneaux
parent 00501eeb6e
commit 5af33410f6
2 changed files with 2 additions and 1 deletions

View file

@ -581,7 +581,7 @@ amd64_emitfn(Fn *fn, FILE *f)
uint64_t fs;
emitfnlnk(fn->name, &fn->lnk, f);
fputs("\tpushq %rbp\n\tmovq %rsp, %rbp\n", f);
fputs("\tendbr64\n\tpushq %rbp\n\tmovq %rsp, %rbp\n", f);
fs = framesz(fn);
if (fs)
fprintf(f, "\tsubq $%"PRIu64", %%rsp\n", fs);

View file

@ -514,6 +514,7 @@ arm64_emitfn(Fn *fn, FILE *out)
if (T.apple)
e->fn->lnk.align = 4;
emitfnlnk(e->fn->name, &e->fn->lnk, e->f);
fputs("\thint\t#34\n", e->f);
framelayout(e);
if (e->fn->vararg && !T.apple) {