This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/81863] [7 regression] -mword-relocations is unreliable


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81863

--- Comment #9 from ard.biesheuvel at linaro dot org ---
(In reply to Yvan Roux from comment #8)
> On 7 branch the following should fix the issue, but as I mentioned in
> comment #5, maybe TARGET_USE_MOVT is a better place to do the checking but
> this will need some 
> s/TARGET_HAVE_MOVT/TARGET_USE_MOVT/ 
> 
> --- a/gcc/config/arm/arm.h
> +++ b/gcc/config/arm/arm.h
> @@ -272,7 +272,8 @@ extern tree arm_fp16_type_node;
>                                  && arm_arch_notm)
>  
>  /* Nonzero if this chip provides the MOVW and MOVT instructions.  */
> -#define TARGET_HAVE_MOVT       (arm_arch_thumb2 || arm_arch8)
> +#define TARGET_HAVE_MOVT       ((arm_arch_thumb2 || arm_arch8) \
> +                                && !target_word_relocations)
>  
>  /* Nonzero if this chip provides the CBZ and CBNZ instructions.  */
>  #define TARGET_HAVE_CBZ                (arm_arch_thumb2 || arm_arch8)

OK, so this will disable *all* uses of movw/movt pairs even for constants or,
more importantly, relative references.

I am aware that GCC current never emits those, but for the kernel use case,
having GCC emit place-relative movw/movt pairs for PIC addressing rather than
literals (in case we are referencing symbols with external linkage and hidden
visibility) would be very useful (I'm aware the limited range of the addend
complicates this for static linkage). GOT indirection is pointless in the
kernel, because there is no preemption and there are no concerns regarding
locality or text relocations.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]