aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2019-07-18 00:06:41 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2019-07-18 00:06:41 +0000
commit9cc7debee91270a91ce6e9ad65740b8e35743c61 (patch)
tree15c3d64671a9aa19ab72f42c31bb87380d40228b /gcc
parentcaffb6e56c2914e64e65f3c336b770c178f265a3 (diff)
downloadgcc-9cc7debee91270a91ce6e9ad65740b8e35743c61.zip
gcc-9cc7debee91270a91ce6e9ad65740b8e35743c61.tar.gz
gcc-9cc7debee91270a91ce6e9ad65740b8e35743c61.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/pa/pa.c35
2 files changed, 28 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6d8b082..7f55623 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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.
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 0d00bf6..f54ca6e 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -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