This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


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

RE: 3.0.1 PATCH: Avoid non-PIC code in boehm-gc for Solaris 2/Intel


Thanks for pointing this out.  I'd also like to fix it in version 6.0 of the
GC.

The patch seems a bit brittle to me.  You're inserting compiler generated
code in a position at which the stack pointer is 4 bytes displaced from
where the compiler thinks it is.  This strikes me as dangerous, particularly
since this should also compile with non-gcc compilers. You're also counting
on the compiler not to push anything on the stack between the argument push
and the call.

Is there a way to fix this entirely in assembly code, possibly in a separate
file?  At least in the gcc case, it would be safer to combine each call into
a single asm.  If this is hard, we can also look at using the generic
setjmp-based code.

Hans

> -----Original Message-----
> From: Rainer Orth [mailto:ro@TechFak.Uni-Bielefeld.DE]
> Sent: Tuesday, June 26, 2001 5:30 AM
> To: gcc-patches@gcc.gnu.org; java-patches@gcc.gnu.org
> Cc: Hans-J. Boehm
> Subject: 3.0.1 PATCH: Avoid non-PIC code in boehm-gc for 
> Solaris 2/Intel
> 
> 
> An initial attempt to bootstrap GCC 3.0 on Solaris 8/Intel with
> --enable-libgcj failed when trying to link the shared libgcjgc:
> 
> /vol/gcc/obj/gcc-3.0/8-cc-gas/gcc/xgcc 
> -B/vol/gcc/obj/gcc-3.0/8-cc-gas/gcc/ 
> -B/vol/gcc/share/i386-pc-solaris2.8/bin/ 
> -B/vol/gcc/share/i386-pc-solaris2.8/lib/ -isystem 
> /vol/gcc/share/i386-pc-solaris2.8/include -shared -Wl,-h 
> -Wl,libgcjgc.so.1 -o .libs/libgcjgc.so.1.0.1  
> .libs/allchblk.o .libs/alloc.o .libs/blacklst.o 
> .libs/checksums.o .libs/dbg_mlc.o .libs/dyn_load.o 
> .libs/finalize.o .libs/gcj_mlc.o .libs/headers.o 
> .libs/hpux_irix_threads.o .libs/linux_threads.o 
> .libs/malloc.o .libs/mallocx.o .libs/mark.o .libs/mark_rts.o 
> .libs/misc.o .libs/new_hblk.o .libs/obj_map.o .libs/os_dep.o 
> .libs/pcr_interface.o .libs/ptr_chck.o .libs/real_malloc.o 
> .libs/reclaim.o .libs/solaris_pthreads.o 
> .libs/solaris_threads.o .libs/stubborn.o .libs/typd_mlc.o 
> .libs/mach_dep.o  -lpthread -lc 
> Text relocation remains                 	referenced
>     against symbol		    offset	in file
> GC_push_one                         0x5       	.libs/mach_dep.o
> GC_push_one                         0xe       	.libs/mach_dep.o
> GC_push_one                         0x17      	.libs/mach_dep.o
> GC_push_one                         0x20      	.libs/mach_dep.o
> GC_push_one                         0x29      	.libs/mach_dep.o
> GC_push_one                         0x32      	.libs/mach_dep.o
> GC_push_one                         0x3b      	.libs/mach_dep.o
> ld: fatal: relocations remain against allocatable but 
> non-writable sections
> 
> I.e. the current code required text relocations, making the 
> text section
> non-sharable.  The patch below fixes this.  Bootstrapped with no
> regressions on i386-pc-solaris2.8.
> 
> Ok for branch and mainline?
> 
> 	Rainer
> 
> --------------------------------------------------------------
> ---------------
> Rainer Orth, Faculty of Technology, Bielefeld University
> 
> Email: ro@TechFak.Uni-Bielefeld.DE
> 
> 
> Tue Jun 26 14:22:59 2001  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
> 
> 	* mach_dep.c (GC_push_regs) [I386 && SVR4 || SCO || 
> SCO_ELF]: Call
> 	GC_push_one in C to allow for PIC code.
> 
> ===================================================================
> RCS file: boehm-gc/RCS/mach_dep.c,v
> retrieving revision 1.1
> diff -up -r1.1 boehm-gc/mach_dep.c
> --- boehm-gc/mach_dep.c	2000/04/27 00:43:33	1.1
> +++ boehm-gc/mach_dep.c	2000/04/26 22:43:33
> @@ -281,13 +281,13 @@ void GC_push_regs()
>  
>  #       if defined(I386) && (defined(SVR4) || defined(SCO) 
> || defined(SCO_ELF))
>  	/* I386 code, SVR4 variant, generic code does not 
> appear to work */
> -	  asm("pushl %eax");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> -	  asm("pushl %ebx");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> -	  asm("pushl %ecx");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> -	  asm("pushl %edx");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> -	  asm("pushl %ebp");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> -	  asm("pushl %esi");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> -	  asm("pushl %edi");  asm("call GC_push_one"); 
> asm("addl $4,%esp");
> +	  asm("pushl %eax"); GC_push_one (); asm("addl $4,%esp");
> +	  asm("pushl %ebx"); GC_push_one (); asm("addl $4,%esp");
> +	  asm("pushl %ecx"); GC_push_one (); asm("addl $4,%esp");
> +	  asm("pushl %edx"); GC_push_one (); asm("addl $4,%esp");
> +	  asm("pushl %ebp"); GC_push_one (); asm("addl $4,%esp");
> +	  asm("pushl %esi"); GC_push_one (); asm("addl $4,%esp");
> +	  asm("pushl %edi"); GC_push_one (); asm("addl $4,%esp");
>  #       endif
>  
>  #       ifdef NS32K
> 


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