Commit 0589a2a2 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

AIX: Fix DeclareSymbolGlobal on AIX

Port 929dd374

Original Commit Message:

    When CFI is enabled this adds a check against this list whenever a new
    return address must be set in a deoptimized frame, as a mitigation for
    ROP attacks.
    The list is known at linking time so that its content and the pointer
    to it can be stored in a read-only memory section.
    The check is performed in the signing function, which is no longer
    generic, as well as when setting the current pc of the frame.
    Since the pc is now only signed when setting the caller's pc, there
    is no need for ReplaceContext anymore.

R=salome.thirot@arm.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I5005096811c289707e2d080477c60ae2ed4bf38b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2365372Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#69502}
parent faed2986
......@@ -57,7 +57,9 @@ void PlatformEmbeddedFileWriterAIX::DeclarePointerToSymbol(const char* name,
}
void PlatformEmbeddedFileWriterAIX::DeclareSymbolGlobal(const char* name) {
fprintf(fp_, ".globl %s\n", name);
// These symbols are not visible outside of the final binary, this allows for
// reduced binary size, and less work for the dynamic linker.
fprintf(fp_, ".globl %s, hidden\n", name);
}
void PlatformEmbeddedFileWriterAIX::AlignToCodeAlignment() {
......@@ -73,6 +75,9 @@ void PlatformEmbeddedFileWriterAIX::Comment(const char* string) {
}
void PlatformEmbeddedFileWriterAIX::DeclareLabel(const char* name) {
// .global is required on AIX, if the label is used/referenced in another file
// later to be linked.
fprintf(fp_, ".globl %s\n", name);
fprintf(fp_, "%s:\n", name);
}
......@@ -85,7 +90,9 @@ void PlatformEmbeddedFileWriterAIX::SourceInfo(int fileid, const char* filename,
void PlatformEmbeddedFileWriterAIX::DeclareFunctionBegin(const char* name,
uint32_t size) {
Newline();
DeclareSymbolGlobal(name);
if (ENABLE_CONTROL_FLOW_INTEGRITY_BOOL) {
DeclareSymbolGlobal(name);
}
fprintf(fp_, ".csect %s[DS]\n", name); // function descriptor
fprintf(fp_, "%s:\n", name);
fprintf(fp_, ".llong .%s, 0, 0\n", name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment