aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-07-07 16:34:15 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-07-07 16:34:15 +0000
commit21f94af93a884ba2393b3877d7259922ca7522f3 (patch)
tree0cda6130ac2b9d54ddd2daa807fcc0c0eec02c64
parent2ea649341aa927c126f26642490147871d10a00f (diff)
downloadgcc-21f94af93a884ba2393b3877d7259922ca7522f3.zip
gcc-21f94af93a884ba2393b3877d7259922ca7522f3.tar.gz
gcc-21f94af93a884ba2393b3877d7259922ca7522f3.tar.bz2
[Darwin] Make a final check on PIC options.
Final check on PCI options; for Darwin these are not dependent on the PIE ones, although PIE does require PIC to support it. Specifically, for Darwin, "fPIC fno-PIE" should result in the same as "-fno-PIE -fPIC". 2019-07-07 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c (darwin_override_options): Make a final check on PIC options. From-SVN: r273181
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/darwin.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 39da4f2..0ef7eb6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-07-07 Iain Sandoe <iain@sandoe.co.uk>
+ * config/darwin.c (darwin_override_options): Make a final check on PIC
+ options.
+
+2019-07-07 Iain Sandoe <iain@sandoe.co.uk>
+
* config/darwin.c (darwin_override_options): Don't jam symbol stubs
on for kernel code.
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 02bcf01..5ac0925 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3241,6 +3241,8 @@ darwin_override_options (void)
&& write_symbols == DWARF2_DEBUG)
flag_var_tracking_uninit = flag_var_tracking;
+ /* Final check on PCI options; for Darwin these are not dependent on the PIE
+ ones, although PIE does require PIC to support it. */
if (MACHO_DYNAMIC_NO_PIC_P)
{
if (flag_pic)
@@ -3249,9 +3251,11 @@ darwin_override_options (void)
" %<-fpie%> or %<-fPIE%>");
flag_pic = 0;
}
- else if (flag_pic == 1)
+ else if (flag_pic == 1
+ || (flag_pic == 0 && !(flag_mkernel || flag_apple_kext)))
{
- /* Darwin's -fpic is -fPIC. */
+ /* Darwin's -fpic is -fPIC.
+ We only support "static" code in the kernel and kernel exts. */
flag_pic = 2;
}