Commit 9cc7debe by John David Anglin

pa.c (pa_som_asm_init_sections): Don't force all constant data into data section…

pa.c (pa_som_asm_init_sections): Don't force all constant data into data section when generating PIC code.

	* config/pa/pa.c (pa_som_asm_init_sections): Don't force all constant
	data into data section when generating PIC code.
	(pa_select_section): Use pa_reloc_rw_mask() to qualify relocs.
	(pa_reloc_rw_mask): Return 3 when generating PIC code and when
	generating code for SOM targets earlier than HP-UX 11.  Otherwise,
	return 2 for SOM and 0 for other targets.

From-SVN: r273557
parent caffb6e5
2019-07-17 John David Anglin <danglin@gcc.gnu.org>
* config/pa/pa.c (pa_som_asm_init_sections): Don't force all constant
data into data section when generating PIC code.
(pa_select_section): Use pa_reloc_rw_mask() to qualify relocs.
(pa_reloc_rw_mask): Return 3 when generating PIC code and when
generating code for SOM targets earlier than HP-UX 11. Otherwise,
return 2 for SOM and 0 for other targets.
2019-07-17 Jeff Law <law@redhat.com> 2019-07-17 Jeff Law <law@redhat.com>
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting. * tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting.
......
...@@ -9805,19 +9805,22 @@ pa_som_asm_init_sections (void) ...@@ -9805,19 +9805,22 @@ pa_som_asm_init_sections (void)
= get_unnamed_section (0, output_section_asm_op, = get_unnamed_section (0, output_section_asm_op,
"\t.SPACE $PRIVATE$\n\t.SUBSPA $TM_CLONE_TABLE$"); "\t.SPACE $PRIVATE$\n\t.SUBSPA $TM_CLONE_TABLE$");
/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups /* HPUX ld generates incorrect GOT entries for "T" fixups which
which reference data within the $TEXT$ space (for example constant reference data within the $TEXT$ space (for example constant
strings in the $LIT$ subspace). strings in the $LIT$ subspace).
The assemblers (GAS and HP as) both have problems with handling The assemblers (GAS and HP as) both have problems with handling
the difference of two symbols which is the other correct way to the difference of two symbols. This is the other correct way to
reference constant data during PIC code generation. reference constant data during PIC code generation.
So, there's no way to reference constant data which is in the Thus, we can't put constant data needing relocation in the $TEXT$
$TEXT$ space during PIC generation. Instead place all constant space during PIC generation.
data into the $PRIVATE$ subspace (this reduces sharing, but it
works correctly). */ Previously, we placed all constant data into the $DATA$ subspace
readonly_data_section = flag_pic ? data_section : som_readonly_data_section; when generating PIC code. This reduces sharing, but it works
correctly. Now we rely on pa_reloc_rw_mask() for section selection.
This puts constant data not needing relocation into the $TEXT$ space. */
readonly_data_section = som_readonly_data_section;
/* We must not have a reference to an external symbol defined in a /* We must not have a reference to an external symbol defined in a
shared library in a readonly section, else the SOM linker will shared library in a readonly section, else the SOM linker will
...@@ -9850,7 +9853,7 @@ pa_select_section (tree exp, int reloc, ...@@ -9850,7 +9853,7 @@ pa_select_section (tree exp, int reloc,
&& DECL_INITIAL (exp) && DECL_INITIAL (exp)
&& (DECL_INITIAL (exp) == error_mark_node && (DECL_INITIAL (exp) == error_mark_node
|| TREE_CONSTANT (DECL_INITIAL (exp))) || TREE_CONSTANT (DECL_INITIAL (exp)))
&& !reloc) && !(reloc & pa_reloc_rw_mask ()))
{ {
if (TARGET_SOM if (TARGET_SOM
&& DECL_ONE_ONLY (exp) && DECL_ONE_ONLY (exp)
...@@ -9859,7 +9862,8 @@ pa_select_section (tree exp, int reloc, ...@@ -9859,7 +9862,8 @@ pa_select_section (tree exp, int reloc,
else else
return readonly_data_section; return readonly_data_section;
} }
else if (CONSTANT_CLASS_P (exp) && !reloc) else if (CONSTANT_CLASS_P (exp)
&& !(reloc & pa_reloc_rw_mask ()))
return readonly_data_section; return readonly_data_section;
else if (TARGET_SOM else if (TARGET_SOM
&& TREE_CODE (exp) == VAR_DECL && TREE_CODE (exp) == VAR_DECL
...@@ -9875,12 +9879,11 @@ pa_select_section (tree exp, int reloc, ...@@ -9875,12 +9879,11 @@ pa_select_section (tree exp, int reloc,
static int static int
pa_reloc_rw_mask (void) pa_reloc_rw_mask (void)
{ {
/* We force (const (plus (symbol) (const_int))) to memory when the if (flag_pic || (TARGET_SOM && !TARGET_HPUX_11))
const_int doesn't fit in a 14-bit integer. The SOM linker can't return 3;
handle this construct in read-only memory and we want to avoid
this for ELF. So, we always force an RTX needing relocation to /* HP linker does not support global relocs in readonly memory. */
the data section. */ return TARGET_SOM ? 2 : 0;
return 3;
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment