This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [RFA/PATCH]: sh64: Unnecessary use of datalabel operator
- From: "Clarke, Stephen" <stephen dot clarke at superh dot com>
- To: "Alexandre Oliva" <aoliva at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>, "Joern Rennecke" <amylaar at onetel dot net dot uk>
- Date: Mon, 12 Aug 2002 12:15:15 -0700
- Subject: 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.