This is the mail archive of the 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 (libtool): Improper libgcj.a construction with modern GNU ar

( seen on systems with <~64K command line length limit.)

This is a proper patch for the issue discussed here:

- Report of issue on Darwin:
- Key message of thread:
- Rereport of issue on FreeBSD:

Rebuilt libjava on i386-unknown-freebsd4.5.  -static linking now works
(it makes no sense discussing regressions since it wasn't even usable
out of the default bootstrap tree before).  Given the construction of
this patch, the new code will only ever run when piecewise linking is
being done; AR_FLAGS will only be overridden with a warning when an
object name conflict is actually detectable.  No effort was made to
refine it to detect when conflicts only exist across the actual
piecewise ar commands.  I rejected sorting the object list on the
basename since (a) I didn't know if that was legal or good thing to
do; (b) due to exact placement, a piecewise break points could still
straddle objects with the same name without reworking the command line
break code.

(For good measure, I radically lowered max_cmd_len to 1000; and
 rebuilt libstdc++-v3.  This forced piecewise linking of libstdc++.a
 but since no object name conflicts exist here; it didn't override

Permission to apply to gcc mainline?

	* Detect and handle object name conflicts
	while piecewise linking a static library.

RCS file: /cvs/gcc/gcc/,v
retrieving revision 1.19
diff -c -r1.19
***	16 Mar 2002 14:42:17 -0000	1.19
---	3 May 2002 03:39:18 -0000
*** 4247,4252 ****
--- 4247,4266 ----
+ 	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
+ 	  # encoded into archives.  This makes 'ar r' malfunction in
+ 	  # this piecewise linking case whenever conflicting object
+ 	  # names appear in distinct ar calls; check, warn and compensate.
+           if (for obj in $save_oldobjs
+ 	    do
+ 	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ 	    done | sort | sort -uc >/dev/null 2>&1); then
+ 	    :
+ 	  else
+ 	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
+ 	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
+ 	    AR_FLAGS=cq
+ 	  fi
            for obj in $save_oldobjs
              oldobjs="$objlist $obj"

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