From 6607bdd99994c834f92fce924abdaea3405f62dc Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 1 May 2020 21:03:10 -0700 Subject: Add patch_area_size and patch_area_entry to crtl Currently patchable area is at the wrong place. It is placed immediately after function label and before .cfi_startproc. A backend should be able to add a pseudo patchable area instruction durectly into RTL. This patch adds patch_area_size and patch_area_entry to crtl so that the patchable area info is available in RTL passes. It also limits patch_area_size and patch_area_entry to 65535, which is a reasonable maximum size for patchable area. gcc/ PR target/93492 * cfgexpand.c (pass_expand::execute): Set crtl->patch_area_size and crtl->patch_area_entry. * emit-rtl.h (rtl_data): Add patch_area_size and patch_area_entry. * opts.c (common_handle_option): Limit function_entry_patch_area_size and function_entry_patch_area_start to USHRT_MAX. Fix a typo in error message. * varasm.c (assemble_start_function): Use crtl->patch_area_size and crtl->patch_area_entry. * doc/invoke.texi: Document the maximum value for -fpatchable-function-entry. gcc/c-family/ PR target/93492 * c-attribs.c (handle_patchable_function_entry_attribute): Limit value to USHRT_MAX (65535). gcc/testsuite/ PR target/93492 * c-c++-common/patchable_function_entry-error-1.c: New test. * c-c++-common/patchable_function_entry-error-2.c: Likewise. * c-c++-common/patchable_function_entry-error-3.c: Likewise. --- gcc/opts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/opts.c') diff --git a/gcc/opts.c b/gcc/opts.c index c212a1a..3dccef3 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2615,10 +2615,12 @@ common_handle_option (struct gcc_options *opts, function_entry_patch_area_start = 0; } if (function_entry_patch_area_size < 0 + || function_entry_patch_area_size > USHRT_MAX || function_entry_patch_area_start < 0 + || function_entry_patch_area_start > USHRT_MAX || function_entry_patch_area_size < function_entry_patch_area_start) - error ("invalid arguments for %<-fpatchable_function_entry%>"); + error ("invalid arguments for %<-fpatchable-function-entry%>"); free (patch_area_arg); } break; -- cgit v1.1