From c602426cc72a5ac89efac61a195ee38358688c1d Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Fri, 28 Feb 2020 16:35:05 +0000 Subject: [PATCH] Tigthen flag_pic processing in vxworks_override_options This fixes spurious complaints about PIC mode not supported from "gcc --help=...", on VxWorks without -mrtp. The spurious message is emitted by vxworks_override_options, called with flag_pic == -1 when we're running for --help. The change simply adjusts the check testing for "we're generating pic code" to "flag_pic > 0" instead of just "flag_pic". We're not generating code at all when reaching here with -1. gcc/ChangeLog: 2020-10-14 Olivier Hainque * config/vxworks.c (vxworks_override_options): Guard pic checks with flag_pic > 0 instead of just flag_pic. --- gcc/config/vxworks.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c index 970d504c981..ca0f5de12a7 100644 --- a/gcc/config/vxworks.c +++ b/gcc/config/vxworks.c @@ -154,8 +154,10 @@ vxworks_override_options (void) targetm.have_ctors_dtors = TARGET_VXWORKS_HAVE_CTORS_DTORS || HAVE_INITFINI_ARRAY_SUPPORT; - /* PIC is only supported for RTPs. */ - if (flag_pic && !TARGET_VXWORKS_RTP) + /* PIC is only supported for RTPs. flags_pic might be < 0 here, in + contexts where the corresponding switches are not processed, + e.g. from --help. We are not generating code in such cases. */ + if (flag_pic > 0 && !TARGET_VXWORKS_RTP) error ("PIC is only supported for RTPs"); /* VxWorks comes with non-gdb debuggers which only support strict -- 2.11.4.GIT