Project

General

Profile

Actions

Bug #14404

open

Build fails if built in 'unused' dir

Added by Marcel Telka 2 days ago. Updated 1 day ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

If you build illumos in a directory with unused in its name the build fails with ton of following errors:

boot/solaris/bin/symdef: libelf.so.1 =>  /data/builds/il-unused/proto/root_i386/lib/libelf.so.1  (alternate)    <remove lib or -zignore?>
boot/solaris/bin/symdef: libc.so.1 =>    /data/builds/il-unused/proto/root_i386/lib/libc.so.1  (alternate)      <remove lib or -zignore?>
boot/solaris/bin/symdef: libm.so.2 =>    /data/builds/il-unused/proto/root_i386/lib/libm.so.2  (alternate)      <remove lib or -zignore?>
etc/fs/dev/mount: libc.so.1 =>   /data/builds/il-unused/proto/root_i386/lib/libc.so.1  (alternate)      <remove lib or -zignore?>
etc/fs/dev/mount: libm.so.2 =>   /data/builds/il-unused/proto/root_i386/lib/libm.so.2  (alternate)      <remove lib or -zignore?>
etc/fs/hsfs/mount: libc.so.1 =>  /data/builds/il-unused/proto/root_i386/lib/libc.so.1  (alternate)      <remove lib or -zignore?>
etc/fs/hsfs/mount: libm.so.2 =>  /data/builds/il-unused/proto/root_i386/lib/libm.so.2  (alternate)      <remove lib or -zignore?>
etc/fs/nfs/mount: librpcsvc.so.1 =>      /data/builds/il-unused/proto/root_i386/lib/librpcsvc.so.1  (alternate) <remove lib or -zignore?>
etc/fs/nfs/mount: libnsl.so.1 =>         /data/builds/il-unused/proto/root_i386/lib/libnsl.so.1  (alternate)    <remove lib or -zignore?>
etc/fs/nfs/mount: libsocket.so.1 =>      /data/builds/il-unused/proto/root_i386/lib/libsocket.so.1  (alternate) <remove lib or -zignore?>
etc/fs/nfs/mount: libscf.so.1 =>         /data/builds/il-unused/proto/root_i386/lib/libscf.so.1  (alternate)    <remove lib or -zignore?>
...

The problem seems to be here in check_rtime.pl:

471         # Look for any unused dependencies.
472         if ($UnDep && ($Line =~ /unused/)) {
473             # Skip if object is allowed to have unused dependencies
474             next if defined($EXRE_unused_deps) &&
475                 ($RelPath =~ $EXRE_unused_deps);
476 
477             # Skip if dependency is always allowed to be unused
478             next if defined($EXRE_unused_obj) &&
479                 ($Line =~ $EXRE_unused_obj);
480 
481             $Line =~ s!$Tmpdir/!! if $Secure;
482             $Line =~ s/^[ \t]*(.*)/$1\t<remove lib or -zignore?>/;
483             onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath, $Line);
484             next;
485         }

We apparently need more specific regular expression to match unused dependencies.

Actions #1

Updated by Marcel Telka 2 days ago

Here is a way how to force ldd to output some "unused" lines:

$ echo "int main(void) {return 0;}" > a.c ; gcc -lnsl a.c ; ldd -rU a.out ; rm -f a.c a.out
        libnsl.so.1 =>   /lib/libnsl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libmp.so.2 =>    /lib/libmp.so.2
        libmd.so.1 =>    /lib/libmd.so.1
        libm.so.2 =>     /lib/libm.so.2

   unused search path=/usr/gcc/7/lib  (RUNPATH/RPATH from file a.out)

   unused search path=/usr/gcc/7/lib  (RUNPATH/RPATH from file /lib/libnsl.so.1)
   unreferenced object=/lib/libnsl.so.1; unused dependency of a.out
   unused object=/lib/libnsl.so.1; member of cyclic group [1]
   unused search path=/usr/gcc/7/lib  (RUNPATH/RPATH from file /lib/libmp.so.2)
   unused search path=/usr/gcc/7/lib  (RUNPATH/RPATH from file /lib/libmd.so.1)
   unused search path=/usr/gcc/7/lib  (RUNPATH/RPATH from file /lib/libm.so.2)
$

I do not know if there is other possible legal "unused" output from ldd, but if it is not, then we need to change 472 if ($UnDep && ($Line =~ /unused/)) { to 472 if ($UnDep && ($Line =~ /unused object=/)) {. The other "unused" case (unused search path=) is already handled by the check_rtime.pl script here:

442         # Look for any unused search paths.
443         if ($Line =~ /unused search path=/) {
444             next if defined($EXRE_unused_rpath) &&
445                 ($Line =~ $EXRE_unused_rpath);
446 
447             if ($Secure) {
448                 $Line =~ s!$Tmpdir/!!;
449             }
450             $Line =~ s/^[ \t]*(.*)/\t$1\t<remove search path?>/;
451             onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath, $Line);
452             next;
453         }
Actions #2

Updated by Marcel Telka 1 day ago

It looks like all possible "unused" output strings for ldd are in the cmd/sgs/rtld/common/rtld.msg file.

Actions #3

Updated by Marcel Telka 1 day ago

  • Status changed from New to In Progress
  • Assignee set to Marcel Telka
Actions

Also available in: Atom PDF