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]

Re: [PATCH] PIC support for SH


Hello,

Alexandre Oliva <aoliva@redhat.com> wrote:
>> 	* gcc/config/sh/elf.h: Add -pic option to the assembler in -fpic
>> 	case.
> 
>What was the rationale for requiring a `-pic' option in the assembler?
>In our internal implementation, derived from ours, we didn't keep this
>flag.

Our change for binutils needs it. But if Red Hat implementaion doesn't
need such bad thing, Linux/SH people will become very happy.

>> 	(print_operand): Add a modifier code $ to print REGISTER_PREFIX.
> 
> What's the point of using a register prefix?  It doesn't help at all,
> even when you remove the underscore prefix from symbol names.  Using a
> register prefix only makes sense to disambiguate them from symbol
> names, but there's no need for this disambiguation in SH assembly code
> generated by GCC.  Code generated by GCC never references global
> symbols as immediates, since it must always go through the constant
> pool.
> 
> As operands to regular instructions, we'd still parse a name that
> matches a register name as a register, since the `$' prefix is
> optional.  In the constant pool, registers don't make sense.  So, the
> only case that requires disambiguation is when you want to refer to a
> non-.L symbol as an immediate operand to an instruction.  Since the
> `$' prefix is optional, this has to be done by prefixing the symbol
> with `0+', so that the assembler understands the operand as an
> expression, and parses the following name as a symbol, not as a
> register.
> 
> Of course, we could support `$' prefixes, with a 4-line change in the
> assembler, but I didn't think it was worth it.  It's probably better
> to remove any uses of it from the (hopefully small) existing
> code-base of hand-crafted assembly that uses this extension.

I don't have strong opinion about this issue. Once we were afraid that
SH's register name collide with the normal symbols without the underscore
in unknown complex situation. But we've seen no such problem.
OTOH, some existing codes use this. Maybe, one solution is that we
declare this feature will be obsolete and assembler permits the use of
the register prefix with warning.

>> 	(NEED_PLT_GOT): Defined.
>> 	(GOT_PCREL): Likewize.
> 
> Any reason why you're defining these?  They don't seem to be used
> anywhere.

Oh, sorry. These should be cleaned up, as you say.

> I'll post the patches we have for PIC support on SH shortly.

Thank you Alex. We Linux/SH people would like to express our hearty
thanks to you and Red Hat GCC team!

	kaz

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