[PATCH] Improve and consolidate sparc PIC assembler.

Torbjorn Granlund tg at gmplib.org
Sat Apr 13 23:55:24 CEST 2013


David Miller <davem at davemloft.net> writes:

  From: Torbjorn Granlund <tg at gmplib.org>
  Date: Sat, 13 Apr 2013 21:52:40 +0200
  
  > Really?  What does our case have to do with TLS?  The example error
  > message uses a TLS reloc, we don't.
  
  Implicit section at the beginning of assembly?
  
  Here, try these two things:
  
  1) Build:
  
  	static const char foo[] = { 1, 2, 3, 4, 5, 6 };
  
  	const char *test(void)
  	{
  		return &foo[0];
  	}
  
    with gcc -m64 -O2 -fPIC -S -o test.s test.c, let me know what
    gcc emits.
  
        .file   "x.c"
        .section        ".rodata"
        .align 8
        .type   foo, #object
        .size   foo, 6
foo:
        .byte   1
        .byte   2
        .byte   3
        .byte   4
        .byte   5
        .byte   6
        .section        ".text"
        .align 4
.LLGETPC0:
        retl
        add     %o7, %l7, %l7
        .align 4
        .global test
        .type   test, #function
        .proc   0102
test:
        !#PROLOGUE# 0
        save    %sp, -192, %sp
        sethi   %hi(foo), %g1
        sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
        call    .LLGETPC0
        add     %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
        or      %g1, %lo(foo), %g1
        ldx     [%l7+%g1], %i0
        return  %i7+8
        nop
        .size   test, .-test
        .ident  "GCC: (GNU) 3.4.4"

(Very old gcc, tried building a gcc 4.8 cross compiler for
--target=sparc-sun-solaris10, but it fails to configure.)

  2) Put ctz_table at the end of gcd_1.asm and see if that makes
     a difference.

No difference.

-- 
Torbjörn


More information about the gmp-devel mailing list