On Wed, Apr 10, 2019 at 03:00:43PM -0300, Joao Moreira wrote: > When -fpatchable-relocation-entry is used, gcc places nops on the > prologue of each compiled function and creates a section named > __patchable_function_entries which holds relocation entries for the > positions in which the nops were placed. As is, gcc creates this > section without the proper section flags, causing crashes in the > compiled program during its load. > > Given the above, fix the problem by creating the section with the > SECTION_WRITE and SECTION_RELRO flags. > > The problem was noticed while compiling glibc with > -fpatchable-function-entry compiler flag. After applying the patch, > this issue was solved. > > This was also tested on x86-64 arch without visible problems under > the gcc standard tests.
Thanks for the patch. Just some nits: > 2019-04-10 Joao Moreira <jmore...@suse.de> Two spaces after the name. > > * gcc/targhooks.c (default_print_patchable_function_entry): emit > __patchable_function_entries section with writable flags to allow > relocation resolution. Please drop the gcc/ prefix and use capital E in "emit". > --- > gcc/targhooks.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/targhooks.c b/gcc/targhooks.c > index 318f7e9784a..9fbaa255747 100644 > --- a/gcc/targhooks.c > +++ b/gcc/targhooks.c > @@ -1814,7 +1814,7 @@ default_print_patchable_function_entry (FILE *file, > ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE", patch_area_number); > > switch_to_section (get_section ("__patchable_function_entries", > - 0, NULL)); > + SECTION_WRITE | SECTION_RELRO , NULL)); Redundant space before ,. Marek