Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AIX][clang] Storage Locations for Constant Pointers
This patch adds clang options `-mxcoff-roptr` and `-mno-xcoff-roptr` to specify storage locations for constant pointers on AIX. When the `-mxcoff-roptr` option is in effect, constant pointers, virtual function tables, and virtual type tables are placed in read-only storage. When the `-mno-xcoff-roptr` option is in effect, pointers, virtual function tables, and virtual type tables are placed are placed in read/write storage. This patch depends on https://reviews.llvm.org/D144189. Reviewed By: hubert.reinterpretcast, stephenpeckham Differential Revision: https://reviews.llvm.org/D144190
- Loading branch information
Showing
11 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -triple=powerpc-ibm-aix-xcoff -mxcoff-roptr -fdata-sections \ | ||
// RUN: -S <%s | FileCheck %s --check-prefix=CHECK32 | ||
// RUN: %clang_cc1 -triple=powerpc64-ibm-aix-xcoff -mxcoff-roptr -fdata-sections \ | ||
// RUN: -S <%s | FileCheck %s --check-prefix=CHECK64 | ||
// RUN: not %clang_cc1 -triple=powerpc-ibm-aix-xcoff -mxcoff-roptr \ | ||
// RUN: -S <%s 2>&1 | FileCheck %s --check-prefix=DATA_SECTION_ERR | ||
// RUN: not %clang_cc1 -triple=powerpc64-ibm-aix-xcoff -mxcoff-roptr \ | ||
// RUN: -S <%s 2>&1 | FileCheck %s --check-prefix=DATA_SECTION_ERR | ||
// RUN: not %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -mxcoff-roptr \ | ||
// RUN: %s 2>&1 | FileCheck %s --check-prefix=TARGET_ROPTR_ERR | ||
|
||
char c1 = 10; | ||
char* const c1_ptr = &c1; | ||
// CHECK32: .csect c1_ptr[RO],2 | ||
// CHECK32-NEXT: .globl c1_ptr[RO] | ||
// CHECK32-NEXT: .align 2 | ||
// CHECK32-NEXT: .vbyte 4, c1[RW] | ||
|
||
// CHECK64: .csect c1_ptr[RO],3 | ||
// CHECK64-NEXT: .globl c1_ptr[RO] | ||
// CHECK64-NEXT: .align 3 | ||
// CHECK64-NEXT: .vbyte 8, c1[RW] | ||
|
||
// DATA_SECTION_ERR: error: -mxcoff-roptr is supported only with -fdata-sections | ||
// TARGET_ROPTR_ERR: error: unsupported option '-mxcoff-roptr' for target 'powerpc64le-unknown-linux-gnu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mxcoff-roptr %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefixes=ROPTR,LINK | ||
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -c -mxcoff-roptr %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=ROPTR | ||
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff -mxcoff-roptr -mno-xcoff-roptr %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=NO_ROPTR | ||
|
||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mxcoff-roptr %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefixes=ROPTR,LINK | ||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -S -mxcoff-roptr %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=ROPTR | ||
// RUN: %clang -### --target=powerpc-ibm-aix-xcoff %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=NO_ROPTR | ||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mxcoff-roptr -flto %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefixes=ROPTR,LINK,LTO_ROPTR | ||
// RUN: touch %t.o | ||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mxcoff-roptr %t.o 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=LINK | ||
|
||
// RUN: %clang -### --target=powerpc64le-unknown-linux-gnu -mxcoff-roptr \ | ||
// RUN: %s 2>&1 | FileCheck %s --check-prefix=TARGET_ROPTR_ERR | ||
// RUN: %clang -### --target=powerpc64le-unknown-linux-gnu -mno-xcoff-roptr \ | ||
// RUN: %s 2>&1 | FileCheck %s --check-prefix=TARGET_NOROPTR_ERR | ||
// RUN: touch %t.o | ||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mxcoff-roptr -shared \ | ||
// RUN: %t.o 2>&1 | FileCheck %s --check-prefix=SHARED_ERR | ||
// RUN: %clang -### --target=powerpc64le-unknown-linux-gnu -mxcoff-roptr -flto \ | ||
// RUN: %t.o 2>&1 | FileCheck %s --check-prefix=TARGET_ROPTR_ERR | ||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mxcoff-roptr -flto -fno-data-sections \ | ||
// RUN: %t.o 2>&1 | FileCheck %s --check-prefix=DATA_SECTION_ERR | ||
// RUN: %clang -### --target=powerpc64-ibm-aix-xcoff -mno-xcoff-roptr -flto -fno-data-sections \ | ||
// RUN: %t.o 2>&1 | FileCheck %s --check-prefix=NO_DATA_SECTION_ERR | ||
// RUN: %clang -### --target=powerpc64le-unknown-linux-gnu -mno-xcoff-roptr -flto \ | ||
// RUN: %t.o 2>&1 | FileCheck %s --check-prefix=TARGET_NOROPTR_ERR | ||
|
||
// ROPTR: "-mxcoff-roptr" | ||
// LINK: "-bforceimprw" | ||
// LTO_ROPTR: "-bplugin_opt:-mxcoff-roptr" | ||
// NO_ROPTR-NOT: "-mxcoff-roptr" | ||
// NO_ROPTR-NOT: "-bforceimprw" | ||
|
||
// DATA_SECTION_ERR: error: -mxcoff-roptr is supported only with -fdata-sections | ||
// NO_DATA_SECTION_ERR-NOT: error: -mxcoff-roptr is supported only with -fdata-sections | ||
// TARGET_ROPTR_ERR: error: unsupported option '-mxcoff-roptr' for target 'powerpc64le-unknown-linux-gnu' | ||
// TARGET_NOROPTR_ERR: error: unsupported option '-mno-xcoff-roptr' for target 'powerpc64le-unknown-linux-gnu' | ||
// SHARED_ERR: error: -mxcoff-roptr is not supported with -shared |