PPC/S390: Place SaveCalleeSavedRegisters under the .text section

Top-level inline-asm has no knowledge of its current section and
continues under whatever section that was defined before it.

`src/heap/base/stack.h` in this case is defining some global
constant values and as a result the previous section in this case
is `.rodata`, hence we may be placing instructions in a (potentially
not properly aligned) read only data section (which happens to become executable).

This CL forces the assembler to place these in the .text section and
gives them a correct alignment.

Change-Id: Ie9288b6c024f6ff0f399620169e5f777986e96c7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4035887
Reviewed-by: Nikolaos Papaspyrou <nikolaos@chromium.org>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#84367}
This commit is contained in:
Milad Fa 2022-11-17 16:06:57 -05:00 committed by V8 LUCI CQ
parent 2f4397d652
commit 23f4346062
2 changed files with 8 additions and 3 deletions

View File

@ -26,12 +26,15 @@ static_assert(heap::base::Stack::NumberOfCalleeSavedRegisters() == 20,
"Mismatch in the number of callee-saved registers");
static_assert(sizeof(intptr_t) == 8, "Mismatch in word size");
asm(".align 2 \n"
asm(
#if defined(_AIX)
".globl .SaveCalleeSavedRegisters, hidden \n"
".csect .text[PR] \n"
".align 2 \n"
".globl .SaveCalleeSavedRegisters, hidden \n"
".SaveCalleeSavedRegisters: \n"
#else
".text \n"
".align 2 \n"
".globl SaveCalleeSavedRegisters \n"
".type SaveCalleeSavedRegisters, %function \n"
".hidden SaveCalleeSavedRegisters \n"

View File

@ -21,7 +21,9 @@ static_assert(heap::base::Stack::NumberOfCalleeSavedRegisters() == 10,
"Mismatch in the number of callee-saved registers");
static_assert(sizeof(intptr_t) == 8, "Mismatch in word size");
asm(".globl SaveCalleeSavedRegisters \n"
asm(".text \n"
".align 8 \n"
".globl SaveCalleeSavedRegisters \n"
".type SaveCalleeSavedRegisters, %function \n"
".hidden SaveCalleeSavedRegisters \n"
"SaveCalleeSavedRegisters: \n"