[PATCH] Revert of tc-sparc.h changes which break pic

Jakub Jelinek jj@sunsite.ms.mff.cuni.cz
Mon Jul 26 09:13:00 GMT 1999


Hi!

Ian's patch to tc-sparc.h broke -fpic/PIC support on SPARC completely.
I agree the patch is the right way to go, but first of all
elf{32,64}_sparc.c have to be tought to grok it.
The issue is that the change made symbols like .LLC001 go away and thus
assembler output was GOT22/GOT13/GOT10 with e.g. .rodata symbol and non-zero
addend, which sparc ELF backends just screw up.
Can this be applied and I will hack up support for non-zero addends for GOT
relocations? (I think it will be enough to do this for local symbols only,
the Alpha way of doing things seems to be too complicated for this issue.
I guess I could use a hash table for it, not linked lists as Alpha).
Example of code which barfs is e.g.:
gcc -shared -o libfoo.so foo.c
foo.c:
void foo(void)
{
	printf ("bar");
}
not to mention ld.so's
  __asm("sethi %%hi(.Load_address), %1\n"
        ".Load_address:\n\t"
        "rd %%pc, %0\n\t"
        "or %1, %%lo(.Load_address), %1\n\t"
        : "=r"(pc), "=r"(la));

1999-07-25  Jakub Jelinek  <jj@ultra.linux.cz>

	* gas/config/tc-sparc.h (tc_fix_adjustable): Revert July, 10th
	change until elfNN_sparc.c are tought to handle got entries with
	non-zero addend correctly.

--- tc-sparc.h.jj9x	Fri Jul 23 17:00:15 1999
+++ tc-sparc.h.jj9	Mon Jul 26 15:53:47 1999
@@ -132,7 +132,8 @@
        || ((FIX)->fx_subsy != NULL					\
 	   && (S_GET_SEGMENT ((FIX)->fx_subsy)				\
 	       == S_GET_SEGMENT ((FIX)->fx_addsy)))			\
-       || S_IS_LOCAL ((FIX)->fx_addsy)))
+       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL		\
+       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
 #endif
 
 #ifdef OBJ_AOUT

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux  |  http://ultra.linux.cz/  |  http://ultra.penguin.cz/
Linux version 2.2.10 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________


More information about the Binutils mailing list