Re: [PATCH] Add support for putting jump table into relocation read-only section

2020-09-08 Thread Segher Boessenkool
Hi! On Mon, Aug 24, 2020 at 03:53:44PM +0800, HAO CHEN GUI wrote: >   abs_jump_table = (!CASE_VECTOR_PC_RELATIVE >                                     && > !targetm.asm_out.generate_pic_addr_diff_vec ()) ? 1 : 0; x = y ? 1 : 0; is the same as x = y; if y is already only 0 or 1, and ot

Re: [PATCH] Add support for putting jump table into relocation read-only section

2020-08-24 Thread HAO CHEN GUI via Gcc-patches
Hi, I revised the patch according to the advice. The attachment is the revised change log and diff file. Thanks a lot. Now it first judges if it's absolute jump table or not. Then decide if the relocation is needed.   abs_jump_table = (!CASE_VECTOR_PC_RELATIVE                           

Re: [PATCH] Add support for putting jump table into relocation read-only section

2020-08-17 Thread Segher Boessenkool
Hi! On Mon, Aug 17, 2020 at 10:28:31AM +0800, HAO CHEN GUI wrote: > >For the reloc,  my understanding is the jump table needs to be > >relocated if it's a non-relative jump table and PIC flag is set at the > >same time. Yes, I did say the *existing* code seems sub-optimal, too :-) > >According

Re: [PATCH] Add support for putting jump table into relocation read-only section

2020-08-16 Thread HAO CHEN GUI via Gcc-patches
Segher, Please ignore the attachments in my last email. My editor cached the old things. Now they should be correct. Sorry for that. On 17/8/2020 上午 10:20, HAO CHEN GUI wrote: Segher, Seems I sent the wrong diff file. Now the attachments should be correct ones. Sorry for that. For the r

Re: [PATCH] Add support for putting jump table into relocation read-only section

2020-08-16 Thread HAO CHEN GUI via Gcc-patches
Segher, Seems I sent the wrong diff file. Now the attachments should be correct ones. Sorry for that. For the reloc,  my understanding is the jump table needs to be relocated if it's a non-relative jump table and PIC flag is set at the same time. //stmt.c  if (CASE_VECTOR_PC_RELATIVE  

Re: [PATCH] Add support for putting jump table into relocation read-only section

2020-08-14 Thread Segher Boessenkool
Hi! On Fri, Aug 14, 2020 at 03:20:03PM +0800, HAO CHEN GUI wrote: > section * > select_jump_table_section (tree decl) > { >   int reloc; >   bool section_reloc; > >   reloc = (! CASE_VECTOR_PC_RELATIVE && flag_pic && >    ! targetm.asm_out.generate_pic_addr_diff_vec ()) ? 1 : > 0; (Mode

[PATCH] Add support for putting jump table into relocation read-only section

2020-08-14 Thread HAO CHEN GUI via Gcc-patches
Hi, This patch adds a section selection for jump tables. The jump tables can be put into read-only data section or relocation read-only data section by the relocation flags. When the PIC flag is set and jump table is non-relative, the jump table is put into relocation read-only section. sect

[PATCH] Add support for putting jump table into relocation read-only section

2020-08-14 Thread HAO CHEN GUI via Gcc-patches
Hi, This patch adds a section selection for jump tables. The jump tables can be put into read-only data section or relocation read-only data section by the relocation flags. When the PIC flag is set and jump table is non-relative, the jump table is put into relocation read-only section. sect