-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Driver][PS5] Set visibility option defaults #92091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,6 +358,12 @@ void toolchains::PS4PS5Base::addClangTargetOptions( | |
|
||
CC1Args.push_back("-fno-use-init-array"); | ||
|
||
// Default to `hidden` visibility for PS5. | ||
if (getTriple().isPS5() && | ||
!DriverArgs.hasArg(options::OPT_fvisibility_EQ, | ||
options::OPT_fvisibility_ms_compat)) | ||
CC1Args.push_back("-fvisibility=hidden"); | ||
|
||
// Default to -fvisibility-global-new-delete=source for PS5. | ||
if (getTriple().isPS5() && | ||
!DriverArgs.hasArg(options::OPT_fvisibility_global_new_delete_EQ, | ||
|
@@ -376,24 +382,32 @@ void toolchains::PS4PS5Base::addClangTargetOptions( | |
else | ||
CC1Args.push_back("-fvisibility-dllexport=protected"); | ||
|
||
// For PS4 we override the visibilty of globals definitions without | ||
// dllimport or dllexport annotations. | ||
if (DriverArgs.hasArg(options::OPT_fvisibility_nodllstorageclass_EQ)) | ||
DriverArgs.AddLastArg(CC1Args, | ||
options::OPT_fvisibility_nodllstorageclass_EQ); | ||
else | ||
else if (getTriple().isPS4()) | ||
CC1Args.push_back("-fvisibility-nodllstorageclass=hidden"); | ||
else | ||
CC1Args.push_back("-fvisibility-nodllstorageclass=keep"); | ||
|
||
if (DriverArgs.hasArg(options::OPT_fvisibility_externs_dllimport_EQ)) | ||
DriverArgs.AddLastArg(CC1Args, | ||
options::OPT_fvisibility_externs_dllimport_EQ); | ||
else | ||
CC1Args.push_back("-fvisibility-externs-dllimport=default"); | ||
|
||
// For PS4 we override the visibilty of external globals without | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for reviewer: This comment is new and replaces a comment in our downstream code that wasn't suitable for upstream as it referenced internal tracking numbers. |
||
// dllimport or dllexport annotations. | ||
if (DriverArgs.hasArg( | ||
options::OPT_fvisibility_externs_nodllstorageclass_EQ)) | ||
DriverArgs.AddLastArg( | ||
CC1Args, options::OPT_fvisibility_externs_nodllstorageclass_EQ); | ||
else | ||
else if (getTriple().isPS4()) | ||
CC1Args.push_back("-fvisibility-externs-nodllstorageclass=default"); | ||
else | ||
CC1Args.push_back("-fvisibility-externs-nodllstorageclass=keep"); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// Check PS4 specific interactions between visibility options. | ||
/// Detailed testing of -fvisibility-from-dllstorageclass is covered elsewhere. | ||
|
||
/// Check defaults. | ||
// RUN: %clang -### -target x86_64-scei-ps4 -x cl -c -emit-llvm %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=DEFAULT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// DEFAULT-DAG: "-fvisibility-from-dllstorageclass" | ||
// DEFAULT-DAG: "-fvisibility-dllexport=protected" | ||
// DEFAULT-DAG: "-fvisibility-nodllstorageclass=hidden" | ||
// DEFAULT-DAG: "-fvisibility-externs-dllimport=default" | ||
// DEFAULT-DAG: "-fvisibility-externs-nodllstorageclass=default" | ||
|
||
/// Check that -fvisibility-from-dllstorageclass is added in the presence of -fvisibility=. | ||
// RUN: %clang -### -target x86_64-scei-ps4 -x cl -c -emit-llvm -fvisibility=default %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=DEFAULT,VISEQUALS %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// VISEQUALS-DAG: "-fvisibility=default" | ||
|
||
/// Check that -fvisibility-from-dllstorageclass is added in the presence of -fvisibility-ms-compat. | ||
// RUN: %clang -### -target x86_64-scei-ps4 -x cl -c -emit-llvm -fvisibility-ms-compat %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=DEFAULT,MSCOMPT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// MSCOMPT-DAG: "-fvisibility=hidden" | ||
// MSCOMPT-DAG: "-ftype-visibility=default" | ||
|
||
/// -fvisibility-from-dllstorageclass added explicitly. | ||
// RUN: %clang -### -target x86_64-scei-ps4 -x cl -c -emit-llvm -fvisibility-from-dllstorageclass %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=DEFAULT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
|
||
/// -fvisibility-from-dllstorageclass disabled explicitly. | ||
// RUN: %clang -### -target x86_64-scei-ps4 -x cl -c -emit-llvm -fno-visibility-from-dllstorageclass %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=NOVISFROM %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// NOVISFROM-NOT: "-fvisibility-from-dllstorageclass" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already implicitly checked by |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/// Check PS5 specific interactions between visibility options. | ||
/// Detailed testing of -fvisibility-from-dllstorageclass is covered elsewhere. | ||
|
||
/// Check defaults. | ||
// RUN: %clang -### -target x86_64-sie-ps5 -x cl -c -emit-llvm %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=VDEFAULT,VGND_DEFAULT,DEFAULT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// VDEFAULT-DAG: "-fvisibility=hidden" | ||
// VGND_DEFAULT-DAG: "-fvisibility-global-new-delete=source" | ||
// DEFAULT-DAG: "-fvisibility-from-dllstorageclass" | ||
// DEFAULT-DAG: "-fvisibility-dllexport=protected" | ||
// DEFAULT-DAG: "-fvisibility-nodllstorageclass=keep" | ||
// DEFAULT-DAG: "-fvisibility-externs-dllimport=default" | ||
// DEFAULT-DAG: "-fvisibility-externs-nodllstorageclass=keep" | ||
|
||
/// -fvisibility= specified explicitly. | ||
// RUN: %clang -### -target x86_64-sie-ps5 -x cl -c -emit-llvm -fvisibility=protected %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=VPROTECTED,VGND_DEFAULT,DEFAULT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// VPROTECTED-DAG: "-fvisibility=protected" | ||
|
||
/// -fvisibility-ms-compat added explicitly. | ||
// RUN: %clang -### -target x86_64-sie-ps5 -x cl -c -emit-llvm -fvisibility-ms-compat %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=MSCOMPT,VGND_DEFAULT,DEFAULT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// MSCOMPT-DAG: "-fvisibility=hidden" | ||
// MSCOMPT-DAG: "-ftype-visibility=default" | ||
|
||
/// -fvisibility-from-dllstorageclass added explicitly. | ||
// RUN: %clang -### -target x86_64-sie-ps5 -x cl -c -emit-llvm -fvisibility-from-dllstorageclass %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=VDEFAULT,VGND_DEFAULT,DEFAULT %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
|
||
/// -fvisibility-from-dllstorageclass disabled explicitly. | ||
// RUN: %clang -### -target x86_64-sie-ps5 -x cl -c -emit-llvm -fno-visibility-from-dllstorageclass %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefixes=VDEFAULT,VGND_DEFAULT,NOVISFROM %s --implicit-check-not=fvisibility --implicit-check-not=ftype-visibility --implicit-check-not=dllstorageclass | ||
// NOVISFROM-NOT: "-fvisibility-from-dllstorageclass" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already excluded by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewer: This comment is new and replaces a comment in our downstream code that wasn't suitable for upstream as it referenced internal tracking numbers.