Patch for sparc.md (get_pc)

Jakub Jelinek jakub@redhat.com
Wed Feb 16 06:56:00 GMT 2000


On Wed, Feb 16, 2000 at 02:54:54PM +0100, Torbjorn Granlund wrote:
> 2000-02-16  Torbjorn Granlund  <tege@swox.com>
> 
> 	* config/sparc/sparc.md (get_pc): Change `-4' to `+4' for sethi.

That's wrong.
_GLOBAL_OFFSET_TABLE_ is a special symbol for the assembler and it results in
R_SPARC_PC22 resp. R_SPARC_PC10 relocations which take into account the
location of the instruction (and as the sethi is 8 bytes before the add, the
math is clear).
Were you trying to solve some particular problem or was it just by chance
that this seemed weird to you?

> 
> *** sparc.md.~1~	Wed Feb 16 14:53:03 2000
> --- sparc.md	Wed Feb 16 14:43:56 2000
> ***************
> *** 2082,2088 ****
>      (set (match_operand 0 "register_operand" "=r")
>   	(unspec [(match_operand 1 "" "") (match_operand 2 "" "")] 2))]
>     "flag_pic && REGNO (operands[0]) == 23"
> !   "sethi\\t%%hi(%a1-4), %0\\n\\tcall\\t%a2\\n\\tadd\\t%0, %%lo(%a1+4), %0"
>     [(set_attr "length" "3")])
>   
>   ;; Currently unused...
> --- 2082,2088 ----
>      (set (match_operand 0 "register_operand" "=r")
>   	(unspec [(match_operand 1 "" "") (match_operand 2 "" "")] 2))]
>     "flag_pic && REGNO (operands[0]) == 23"
> !   "sethi\\t%%hi(%a1+4), %0\\n\\tcall\\t%a2\\n\\tadd\\t%0, %%lo(%a1+4), %0"
>     [(set_attr "length" "3")])
>   
>   ;; Currently unused...
> 
> 
> -- 
> Torbjörn

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.45 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________


More information about the Gcc-patches mailing list