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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: boehm-gc FreeBSD/i386 configuration


See end of http://gcc.gnu.org/ml/java/2002-04/msg00036.html for
details on how this obscure port configuration bug was uncovered.

Rebuilt boehm-gc on i386-*-freebsd4.5.  Studied `make check' results
and the run-time with no regression.  Looked at the static root map
under gdb.  Of note, without the MIN selector, the initially
registered static root regions would (a) overlap in the nominal case;
and (b) possibly be larger than required since the limit check will
escape beyond even the end symbol.  I assume that would be much "less
than ideal" thus I handled it using the obvious technique shown.
Fortunately, GC_find_limit() will only be called twice in those rare
cases where a VM gap is actually present.

After rebuilding libjava.so against this fixed and rebuilt boehm-gc,
the failing instinit2 test case as previously built (i.e. I used the
exact image with an alignment issue that triggered the VM gap) was
seen to run to completion with the expected output.  It had crashed
during the first sweep of the static root (when it encountered a VM
hole).

Permission to apply to mainline?  For the record, I consider this a
critical bug with this port's configuration since it strikes
(seemingly) randomly.  Thus, I would like consideration to move it to
the 3.1 branch ASAP.  Although not entirely obvious from context, this
patch only affects the i386*-*-freebsd* configuration.

BTW, I do wonder how many other current ELF OSes might sometimes
generate such an unmapped VM hole due to the GNU ld default linker
script for ELF platforms which inserts such a space (for undocumented
reasons) before the BSS.  I suppose it depends greatly on how any
given OS manages memory and how its run-time loader starts an image, etc.

	* include/private/gcconfig.h: Add support for an unmapped
	memory hole between the end of the initialized data segment
	and the start of the BSS on FreeBSD/i386.

Index: boehm-gc/include/private/gcconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
retrieving revision 1.11.2.2
diff -c -r1.11.2.2 gcconfig.h
*** gcconfig.h	2002/04/01 23:06:42	1.11.2.2
--- gcconfig.h	2002/04/03 12:58:30
***************
*** 1056,1063 ****
--- 1056,1071 ----
  #	ifdef __ELF__
  #	    define DYNAMIC_LOADING
  #	endif
+ /* Handle unmapped hole i386*-*-freebsd[45]* may put between etext and edata. */
  	extern char etext;
+ 	extern char edata;
+ 	extern char end;
+ #	define NEED_FIND_LIMIT
  #	define DATASTART ((ptr_t)(&etext))
+ #   	define MIN(x,y) ((x) < (y) ? (x) : (y))
+ #	define DATAEND (MIN (GC_find_limit (DATASTART, TRUE), DATASTART2))
+ #	define DATASTART2 ((ptr_t)(&edata))
+ #	define DATAEND2 ((ptr_t)(&end))
  #   endif
  #   ifdef NETBSD
  #	define OS_TYPE "NETBSD"


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