[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#221420: libtool: deletes test coverage files when linking
From: |
Scott James Remnant |
Subject: |
Re: Bug#221420: libtool: deletes test coverage files when linking |
Date: |
Sun, 11 Jan 2004 01:45:24 +0000 |
On Mon, 2003-11-24 at 12:24, Gary V. Vaughan wrote:
> Scott James Remnant wrote:
> | On Tue, 2003-11-18 at 08:02, Andrew Suffield wrote:
> |>I have a source file foo.c, which I compile to foo.lo, and then link
> |>into foo.la (the name prefixes have to match to trigger the bug).
> |>
> |>If I compile with -ftest-coverage, then .libs/foo.bb and .libs/foo.bbg
> |>are created by gcc, which contain the basic block traces needed for
> |>gcov to work.
> |>
> |>When I then link foo.la, libtool blithely deletes foo.bb and foo.bbg.
> |>
> |>It assumes that .libs/$libname.*, other than $libname.$objext, should
> |>be removed. This is, uh, wrong. I have no idea why it's doing this or
> |>what it should do instead.
> |>
> | The only way I can think of would be to either increase the list of
> | specific excludes there, ie. don't remove .bb and .bbg[0], or to change
> | it to removing only specific files.
>
> precious_files_regex, which is `\.${objext}$' by default, but which the user
> can extend with a new `-precious-regex' option?...
>
> Just thinking aloud.
>
Finally had a few free hours to think about this, and I think Gary's
solution is probably about right. I've added a link mode option
'-precious-files-regex' which can be set to prevent removal of anything
you happen to think is precious[0].
The default is "", *.${objext} is never removed because it needs it a
few seconds later to link. Having that as the default for this option
would hurt people as they'd *always* need to include that in there.
Attached a patch[1].
Andrew: does this "fix" #221420 to your satisfaction?
(the patch will apply offset to the Debian 1.5 package)
Gary, et al.: Okay to commit to HEAD?
Scott
[0] *cough*gollum*cough*
[1] it's quite easy, Gary :-)
--
Have you ever, ever felt like this?
Had strange things happen? Are you going round the twist?
diff -ruNp libtool-CVS~/ChangeLog libtool-CVS/ChangeLog
--- libtool-CVS~/ChangeLog 2004-01-08 10:34:52.000000000 +0000
+++ libtool-CVS/ChangeLog 2004-01-11 01:31:14.000000000 +0000
@@ -0,0 +1,9 @@
+2004-01-11 Scott James Remnant <address@hidden>
+
+ * ltmain.in: new -precious-files-regex link mode option
+ to prevent removal of matching files from the temporary
+ output directory.
+ (Debian Bug #221420)
+ * doc/libtool.texi: document the new option.
+ * NEWS: announce the new option.
+
diff -ruNp libtool-CVS~/doc/libtool.texi libtool-CVS/doc/libtool.texi
--- libtool-CVS~/doc/libtool.texi 2004-01-04 20:45:24.000000000 +0000
+++ libtool-CVS/doc/libtool.texi 2004-01-11 01:27:49.000000000 +0000
@@ -1280,6 +1280,11 @@ libraries (@pxref{Inter-library dependen
@item -o @var{output-file}
Create @var{output-file} from the specified objects and libraries.
address@hidden -precious-files-regex @var{regex}
+Prevents removal of files from the temporary output directory whose
+names match this regular expression. You might specify @samp{\.bbg?$}
+to keep those files created with @code{gcc -ftest-coverage} for example.
+
@item -release @var{release}
Specify that the library was generated by release @var{release} of your
package, so that users can easily tell which versions are newer than
diff -ruNp libtool-CVS~/ltmain.in libtool-CVS/ltmain.in
--- libtool-CVS~/ltmain.in 2004-01-06 19:26:17.000000000 +0000
+++ libtool-CVS/ltmain.in 2004-01-11 01:27:49.000000000 +0000
@@ -888,6 +888,7 @@ EOF
no_install=no
objs=
non_pic_objects=
+ precious_files_regex=
prefer_static_libs=no
preload=no
prev=
@@ -1063,6 +1064,11 @@ EOF
prev=
continue
;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
release)
release="-$arg"
prev=
@@ -1439,6 +1445,11 @@ EOF
-o) prev=output ;;
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
-release)
prev=release
continue
@@ -3151,6 +3162,10 @@ EOF
*.$objext)
;;
$output_objdir/$outputname | $output_objdir/$libname.* |
$output_objdir/${libname}${release}.*)
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
removelist="$removelist $p"
;;
*) ;;
@@ -6507,6 +6522,8 @@ The following components of LINK-COMMAND
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
diff -ruNp libtool-CVS~/NEWS libtool-CVS/NEWS
--- libtool-CVS~/NEWS 2004-01-06 19:58:01.000000000 +0000
+++ libtool-CVS/NEWS 2004-01-11 01:27:49.000000000 +0000
@@ -33,6 +33,9 @@ New in 1.5b: 2004-??-??; CVS version 1.5
* Extracting symbols from an import library on cygwin and win32 now works.
* Recognises the 'R' symbol type on Solaris so read-only symbols can be
exported.
+* New link mode option `-precious-files-regex' to prevent accidental removal
+ of files you want to keep, such as test coverage data, from the temporary
+ output directory.
* Initial support for amigaos-ppc.
* Bug fixes.
signature.asc
Description: This is a digitally signed message part
- Re: Bug#221420: libtool: deletes test coverage files when linking,
Scott James Remnant <=