This is the mail archive of the gcc-patches@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]

RE: [RFA/PATCH]: sh64: Unnecessary use of datalabel operator


> From: Alexandre Oliva [mailto:aoliva@redhat.com] 
> Sent: Monday, August 12, 2002 5:48 AM
> 
> The fundamental difference between ARM Thumb and SH5 datalabel is
> that, in the ARM model, it is the label that is marked as code or
> data, so there's no need for the datalabel operator on references.  In
> SH5, each reference must indicate whether it wants the ISA bit for the
> label or not, therefore datalabel must be used or omitted
> consistently.

That wasn't really the intention ...  the intention was that labels
be treated as code or data symbols and the STO_SH5_ISA32 attribute be
given only to SHmedia code labels.  I think this is pretty much the
same as thumb?

But that scheme loses some expressiveness, because sometimes you
really do want to treat a code label as an address rather than as a
branch target (e.g. in the code sequence for a jump table), so we
added the datalabel operator to override the adjustment for the
STO_SH5_ISA32 attribute.

(IIRC, the main concern was reducing the portability
cost from SH-4 assembly language to SHcompact.  We didn't want
people to have to write datalabel (or branchtarget) on all their
data (or code) symbol references, we wanted existing assembly
language to work pretty much automatically, at least in the common
cases.  For the uncommon cases, we invented datalabel.)

> If the following works as intended, I guess I'm ok with your change:
> 
> foo.c:
> #include <stdio.h>
> const int i attribute((section(".text"))) = 1;
> void foo() {
>   printf("%i\n", i);
> }
> 
> bar.c:
> #include <stdio.h>
> extern const int i;
> extern void foo(void);
> main() {
>   printf("%i\n", i);
>   foo();
> }

Of course it doesn't work right now ;-)

However, the compiler explicitly marks i as data using

  .type   _i,@object

If gas were modified so that it did not give the STO_SH5_ISA32
attribute to symbols declared as "object", then the example would
work.

Would you consider this modification to gas, if I prepared a patch
for it?

Steve.


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