public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Revert of tc-sparc.h changes which break pic
@ 1999-07-26  9:13 Jakub Jelinek
  1999-07-26 14:09 ` Richard Henderson
  1999-07-27 12:28 ` Ian Lance Taylor
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 1999-07-26  9:13 UTC (permalink / raw)
  To: binutils; +Cc: David S. Miller

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)
___________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert of tc-sparc.h changes which break pic
  1999-07-26  9:13 [PATCH] Revert of tc-sparc.h changes which break pic Jakub Jelinek
@ 1999-07-26 14:09 ` Richard Henderson
  1999-07-27 12:28 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 1999-07-26 14:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils, David S. Miller

On Mon, Jul 26, 1999 at 06:15:13PM +0200, Jakub Jelinek wrote:
> (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.

Alpha has to contend with multiple GOT tables; Sparc does not.

Yes, sprintf'ing up an appropriate token from input_bfd+symidx+offset
is a resonable solution to the Sparc problem.


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert of tc-sparc.h changes which break pic
  1999-07-26  9:13 [PATCH] Revert of tc-sparc.h changes which break pic Jakub Jelinek
  1999-07-26 14:09 ` Richard Henderson
@ 1999-07-27 12:28 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 1999-07-27 12:28 UTC (permalink / raw)
  To: jj; +Cc: binutils, davem

   Date: Mon, 26 Jul 1999 18:15:13 +0200
   From: Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>

   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.

I'm concerned that changing the addends won't work with the Solaris
native linker.

I have instead checked in this patch, which follows the usual
fix_adjustable approach for ELF files.  Sorry for the problems.

Ian

Index: config/tc-sparc.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-sparc.h,v
retrieving revision 1.4
diff -u -r1.4 tc-sparc.h
--- tc-sparc.h	1999/07/16 21:30:35	1.4
+++ tc-sparc.h	1999/07/27 19:25:34
@@ -127,6 +127,12 @@
 #define tc_fix_adjustable(FIX)						\
   (! S_IS_EXTERNAL ((FIX)->fx_addsy)					\
    && ! S_IS_WEAK ((FIX)->fx_addsy)					\
+   && (FIX)->fx_r_type != BFD_RELOC_SPARC_GOT10				\
+   && (FIX)->fx_r_type != BFD_RELOC_SPARC_GOT13				\
+   && (FIX)->fx_r_type != BFD_RELOC_SPARC_GOT22				\
+   && (FIX)->fx_r_type != BFD_RELOC_SPARC_WPLT30			\
+   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT			\
+   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY			\
    && (! sparc_pic_code							\
        || (FIX)->fx_pcrel						\
        || ((FIX)->fx_subsy != NULL					\

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-07-27 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-26  9:13 [PATCH] Revert of tc-sparc.h changes which break pic Jakub Jelinek
1999-07-26 14:09 ` Richard Henderson
1999-07-27 12:28 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).