public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* m68k Coldfire and PC-relative addressing distances
@ 2023-07-11  9:34 Florian Weimer
  2023-07-11 10:48 ` Richard Biener
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2023-07-11  9:34 UTC (permalink / raw)
  To: gcc

How does the Coldfire m68k subtarget and sure that displacements in PIC
code are within the addressable range?

We have a source file in glibc that fails at assembly because it
contains a branch that is out of range with -fpic.  The GAS error is:

…/iso-2022-jp.s: Fatal error: Tried to convert PC relative branch to absolute jump

(Not sure if this is actually a branch, the diagnostic isn't really
helpful.)

The -fPIC option does not help, and -fpic -mpcrel ICEs at the end of
m68k.cc:sched_attr_op_type.  The op variable at this point is:

(mem/u:HI (const:SI (plus:SI (symbol_ref:SI ("__jisx0212_to_ucs_idx") [flags 0x40] <var_decl 0x7ffff761df30 __jisx0212_to_ucs_idx>)
            (const_int 2 [0x2]))) [2 MEM[(const struct jisx0212_idx *)&__jisx0212_to_ucs_idx].end

The iso-2022-jp.c source file has some large data tables, so it's
probably not surprising that -fpic doesn't work.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: m68k Coldfire and PC-relative addressing distances
  2023-07-11  9:34 m68k Coldfire and PC-relative addressing distances Florian Weimer
@ 2023-07-11 10:48 ` Richard Biener
  2023-07-11 11:08   ` Florian Weimer
  2023-07-11 13:51   ` Jeff Law
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Biener @ 2023-07-11 10:48 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc

On Tue, Jul 11, 2023 at 11:36 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>
> How does the Coldfire m68k subtarget and sure that displacements in PIC
> code are within the addressable range?

There is usually a branch shortening pass relying on correct
instruction lengths.

I suggest to file a bugreport with preprocessed sources as testcase.

Richard.

> We have a source file in glibc that fails at assembly because it
> contains a branch that is out of range with -fpic.  The GAS error is:
>
> …/iso-2022-jp.s: Fatal error: Tried to convert PC relative branch to absolute jump
>
> (Not sure if this is actually a branch, the diagnostic isn't really
> helpful.)
>
> The -fPIC option does not help, and -fpic -mpcrel ICEs at the end of
> m68k.cc:sched_attr_op_type.  The op variable at this point is:
>
> (mem/u:HI (const:SI (plus:SI (symbol_ref:SI ("__jisx0212_to_ucs_idx") [flags 0x40] <var_decl 0x7ffff761df30 __jisx0212_to_ucs_idx>)
>             (const_int 2 [0x2]))) [2 MEM[(const struct jisx0212_idx *)&__jisx0212_to_ucs_idx].end
>
> The iso-2022-jp.c source file has some large data tables, so it's
> probably not surprising that -fpic doesn't work.
>
> Thanks,
> Florian
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: m68k Coldfire and PC-relative addressing distances
  2023-07-11 10:48 ` Richard Biener
@ 2023-07-11 11:08   ` Florian Weimer
  2023-07-19 18:36     ` Joseph Myers
  2023-07-11 13:51   ` Jeff Law
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2023-07-11 11:08 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc

* Richard Biener:

> On Tue, Jul 11, 2023 at 11:36 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>>
>> How does the Coldfire m68k subtarget and sure that displacements in PIC
>> code are within the addressable range?
>
> There is usually a branch shortening pass relying on correct
> instruction lengths.
>
> I suggest to file a bugreport with preprocessed sources as testcase.

Fair enough, I filed PR110627.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: m68k Coldfire and PC-relative addressing distances
  2023-07-11 10:48 ` Richard Biener
  2023-07-11 11:08   ` Florian Weimer
@ 2023-07-11 13:51   ` Jeff Law
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Law @ 2023-07-11 13:51 UTC (permalink / raw)
  To: Richard Biener, Florian Weimer; +Cc: gcc



On 7/11/23 04:48, Richard Biener via Gcc wrote:
> On Tue, Jul 11, 2023 at 11:36 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>>
>> How does the Coldfire m68k subtarget and sure that displacements in PIC
>> code are within the addressable range?
> 
> There is usually a branch shortening pass relying on correct
> instruction lengths.
Generally true, but not so on the m68k unless something significant has 
changed.

On the m68k all this stuff is handled by the assembler.

jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: m68k Coldfire and PC-relative addressing distances
  2023-07-11 11:08   ` Florian Weimer
@ 2023-07-19 18:36     ` Joseph Myers
  0 siblings, 0 replies; 5+ messages in thread
From: Joseph Myers @ 2023-07-19 18:36 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Richard Biener, gcc

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On Tue, 11 Jul 2023, Florian Weimer via Gcc wrote:

> * Richard Biener:
> 
> > On Tue, Jul 11, 2023 at 11:36 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
> >>
> >> How does the Coldfire m68k subtarget and sure that displacements in PIC
> >> code are within the addressable range?
> >
> > There is usually a branch shortening pass relying on correct
> > instruction lengths.
> >
> > I suggest to file a bugreport with preprocessed sources as testcase.
> 
> Fair enough, I filed PR110627.

I think this is technically a regression that appeared around 23 May 
(although almost surely really a latent bug that simply got reintroduced 
on that code by some other changes at that time in the compiler - this 
sort of error has come and gone before).

https://sourceware.org/pipermail/libc-testresults/2023q2/011304.html

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-19 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11  9:34 m68k Coldfire and PC-relative addressing distances Florian Weimer
2023-07-11 10:48 ` Richard Biener
2023-07-11 11:08   ` Florian Weimer
2023-07-19 18:36     ` Joseph Myers
2023-07-11 13:51   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).