diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-05-01 21:03:10 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-05-01 21:04:01 -0700 |
commit | 6607bdd99994c834f92fce924abdaea3405f62dc (patch) | |
tree | 9263654efb733aa5e0fdd7c218ab784c96ae69e0 /gcc/varasm.c | |
parent | 23c42a01bce298d1578bd0421db1d463739cdf2b (diff) | |
download | gcc-6607bdd99994c834f92fce924abdaea3405f62dc.zip gcc-6607bdd99994c834f92fce924abdaea3405f62dc.tar.gz gcc-6607bdd99994c834f92fce924abdaea3405f62dc.tar.bz2 |
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.
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 271a67a..f062e48 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1857,34 +1857,8 @@ assemble_start_function (tree decl, const char *fnname) if (DECL_PRESERVE_P (decl)) targetm.asm_out.mark_decl_preserved (fnname); - unsigned HOST_WIDE_INT patch_area_size = function_entry_patch_area_size; - unsigned HOST_WIDE_INT patch_area_entry = function_entry_patch_area_start; - - tree patchable_function_entry_attr - = lookup_attribute ("patchable_function_entry", DECL_ATTRIBUTES (decl)); - if (patchable_function_entry_attr) - { - tree pp_val = TREE_VALUE (patchable_function_entry_attr); - tree patchable_function_entry_value1 = TREE_VALUE (pp_val); - - patch_area_size = tree_to_uhwi (patchable_function_entry_value1); - patch_area_entry = 0; - if (TREE_CHAIN (pp_val) != NULL_TREE) - { - tree patchable_function_entry_value2 - = TREE_VALUE (TREE_CHAIN (pp_val)); - patch_area_entry = tree_to_uhwi (patchable_function_entry_value2); - } - } - - if (patch_area_entry > patch_area_size) - { - if (patch_area_size > 0) - warning (OPT_Wattributes, - "patchable function entry %wu exceeds size %wu", - patch_area_entry, patch_area_size); - patch_area_entry = 0; - } + unsigned short patch_area_size = crtl->patch_area_size; + unsigned short patch_area_entry = crtl->patch_area_entry; /* Emit the patching area before the entry label, if any. */ if (patch_area_entry > 0) |