-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SFrame][Retry] Add assembler option --gsframe #165806
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -2626,6 +2626,14 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, | |
| llvm::codegenoptions::DebugInfoConstructor, | ||
| DwarfVersion, llvm::DebuggerKind::Default); | ||
| } | ||
| } else if (Value == "--gsframe") { | ||
| if (Triple.isOSBinFormatELF() && Triple.isX86()) { | ||
|
Contributor
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. The comment on line 5970 says that unwind tables are only defined for
Contributor
Author
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. Aarch64 is incomplete in the backend, but on its way. Cleaned up the comment and removed that clause on 5970. |
||
| CmdArgs.push_back("--gsframe"); | ||
| } else { | ||
| D.Diag(diag::err_drv_unsupported_opt_for_target) | ||
| << Value << D.getTargetTriple(); | ||
| break; | ||
| } | ||
| } else if (Value.starts_with("-mcpu") || Value.starts_with("-mfpu") || | ||
| Value.starts_with("-mhwdiv") || Value.starts_with("-march")) { | ||
| // Do nothing, we'll validate it later. | ||
|
|
@@ -5929,6 +5937,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, | |
| else if (UnwindTables) | ||
| CmdArgs.push_back("-funwind-tables=1"); | ||
|
|
||
| // Sframe unwind tables are independent of the other types. Although also | ||
| // defined for aarch64, only x86_64 support is implemented at the moment. | ||
| if (Arg *A = Args.getLastArg(options::OPT_gsframe)) { | ||
| if (Triple.isOSBinFormatELF() && Triple.isX86()) | ||
| CmdArgs.push_back("--gsframe"); | ||
| else | ||
| D.Diag(diag::err_drv_unsupported_opt_for_target) | ||
| << A->getOption().getName() << TripleStr; | ||
| } | ||
|
|
||
| // Prepare `-aux-target-cpu` and `-aux-target-feature` unless | ||
| // `--gpu-use-aux-triple-only` is specified. | ||
| if (!Args.getLastArg(options::OPT_gpu_use_aux_triple_only) && | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // RUN: %clang -### -c --target=x86_64 -Wa,--gsframe %s -Werror 2>&1 | FileCheck %s | ||
| // CHECK: "-cc1" | ||
| // CHECK-SAME: "--gsframe" | ||
|
|
||
| // RUN: %clang -### -c --target=x86_64 %s 2>&1 | FileCheck %s --check-prefix=NO-GSFRAME | ||
| // NO-GSFRAME-NOT: "--gsframe" | ||
|
|
||
| // RUN: %clang -### -c --target=x86_64 -Werror -Wa,--gsframe -x assembler %s -Werror 2>&1 | FileCheck %s --check-prefix=ASM | ||
| // ASM: "-cc1as" | ||
| // ASM-SAME: "--gsframe" | ||
|
|
||
| // RUN: not %clang -### -c --target=mips64 -Wa,--gsframe %s 2>&1 | FileCheck %s --check-prefix=NOTARGETC | ||
| // NOTARGETC: error: unsupported option '--gsframe' for target '{{.*}}' | ||
|
|
||
| // RUN: not %clang -### -c --target=mips64 -Wa,--gsframe -x assembler %s 2>&1 | FileCheck %s --check-prefix=NOTARGETASM | ||
| // NOTARGETASM: error: unsupported option '--gsframe' for target '{{.*}}' | ||
|
Contributor
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. Since this option is only available on
Contributor
Author
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. aarch64 support in the backend is incomplete. So probably better to leave testing out until the backend is ready. I will add it here when it is more mature. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // REQUIRES: x86-registered-target | ||
| // RUN: %clang -cc1as -triple x86_64 %s -filetype obj --gsframe | llvm-readelf -S - | FileCheck %s | ||
|
|
||
| // CHECK: .sframe | ||
| .cfi_startproc | ||
| call foo | ||
| .cfi_endproc |
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.
Since this is only on AArch64 and X86, it may be good to mention that here. This has been done for some other options too, such as
print-supported-extensions. Since AArch64 has not been supported yet, it should probably just be X86.