aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-10-05 08:05:44 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-10-05 08:05:44 +0000
commitd56cbcc0a2ae508afbbc1c3d6a6b925971ff2d6e (patch)
tree37da718774aa725e2cdedda9923bcf2d3820e4e9 /gcc
parent8e007055dd1374ca4c44406a4ead172be0dfa3a8 (diff)
downloadgcc-d56cbcc0a2ae508afbbc1c3d6a6b925971ff2d6e.zip
gcc-d56cbcc0a2ae508afbbc1c3d6a6b925971ff2d6e.tar.gz
gcc-d56cbcc0a2ae508afbbc1c3d6a6b925971ff2d6e.tar.bz2
[Darwin] Amend section for constants with reloactions.
Darwin's linker doesn't like text section relocations (they require special enabling). At least, the Fortran FE seems to generate cases where the initialiser for a pointer constant can need a relocation. We can handle this by special-casing SECCAT_RODATA when the relocation is present by placing the constant in the .const_data section. gcc/ChangeLog: 2019-10-05 Iain Sandoe <iain@sandoe.co.uk> PR target/59888 * config/darwin.c (darwin_rodata_section): Add relocation flag, choose const_data section for constants with relocations. (machopic_select_section): Pass relocation flag to darwin_rodata_section (). From-SVN: r276623
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/darwin.c7
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 171d554..e855712 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-05 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR target/59888
+ * config/darwin.c (darwin_rodata_section): Add relocation flag,
+ choose const_data section for constants with relocations.
+ (machopic_select_section): Pass relocation flag to
+ darwin_rodata_section ().
+
2019-10-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91734
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 3a1be5a..2fb9c56 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1251,12 +1251,13 @@ darwin_mark_decl_preserved (const char *name)
}
static section *
-darwin_rodata_section (int use_coal, bool zsize)
+darwin_rodata_section (int use_coal, bool zsize, int reloc)
{
return (use_coal
? darwin_sections[const_coal_section]
: (zsize ? darwin_sections[zobj_const_section]
- : darwin_sections[const_section]));
+ : reloc ? darwin_sections[const_data_section]
+ : darwin_sections[const_section]));
}
static section *
@@ -1549,7 +1550,7 @@ machopic_select_section (tree decl,
case SECCAT_RODATA:
case SECCAT_SRODATA:
- base_section = darwin_rodata_section (use_coal, zsize);
+ base_section = darwin_rodata_section (use_coal, zsize, reloc);
break;
case SECCAT_RODATA_MERGE_STR: