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>
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting.
......
......@@ -9805,19 +9805,22 @@ pa_som_asm_init_sections (void)
= get_unnamed_section (0, output_section_asm_op,
"\t.SPACE $PRIVATE$\n\t.SUBSPA $TM_CLONE_TABLE$");
/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
which reference data within the $TEXT$ space (for example constant
/* HPUX ld generates incorrect GOT entries for "T" fixups which
reference data within the $TEXT$ space (for example constant
strings in the $LIT$ subspace).
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.
So, there's no way to reference constant data which is in the
$TEXT$ space during PIC generation. Instead place all constant
data into the $PRIVATE$ subspace (this reduces sharing, but it
works correctly). */
readonly_data_section = flag_pic ? data_section : som_readonly_data_section;
Thus, we can't put constant data needing relocation in the $TEXT$
space during PIC generation.
Previously, we placed all constant data into the $DATA$ subspace
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
shared library in a readonly section, else the SOM linker will
......@@ -9850,7 +9853,7 @@ pa_select_section (tree exp, int reloc,
&& DECL_INITIAL (exp)
&& (DECL_INITIAL (exp) == error_mark_node
|| TREE_CONSTANT (DECL_INITIAL (exp)))
&& !reloc)
&& !(reloc & pa_reloc_rw_mask ()))
{
if (TARGET_SOM
&& DECL_ONE_ONLY (exp)
......@@ -9859,7 +9862,8 @@ pa_select_section (tree exp, int reloc,
else
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;
else if (TARGET_SOM
&& TREE_CODE (exp) == VAR_DECL
......@@ -9875,12 +9879,11 @@ pa_select_section (tree exp, int reloc,
static int
pa_reloc_rw_mask (void)
{
/* We force (const (plus (symbol) (const_int))) to memory when the
const_int doesn't fit in a 14-bit integer. The SOM linker can't
handle this construct in read-only memory and we want to avoid
this for ELF. So, we always force an RTX needing relocation to
the data section. */
return 3;
if (flag_pic || (TARGET_SOM && !TARGET_HPUX_11))
return 3;
/* HP linker does not support global relocs in readonly memory. */
return TARGET_SOM ? 2 : 0;
}
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