37 #
38 # By default any file that has conditions that should be reported is first
39 # listed and then each condition follows. The -o (one-line) option produces a
40 # more terse output which is better for sorting/diffing with "nightly".
41 #
42 # NOTE: missing dependencies, symbols or versions are reported by running the
43 # file through ldd(1). As objects within a proto area are built to exist in a
44 # base system, standard use of ldd(1) will bind any objects to dependencies
45 # that exist in the base system. It is frequently the case that newer objects
46 # exist in the proto area that are required to satisfy other objects
47 # dependencies, and without using these newer objects an ldd(1) will produce
48 # misleading error messages. To compensate for this, the -D/-d options, or the
49 # existence of the CODEMSG_WS/ROOT environment variables, cause the creation of
50 # alternative dependency mappings via crle(1) configuration files that establish
51 # any proto shared objects as alternatives to their base system location. Thus
52 # ldd(1) can be executed against these configuration files so that objects in a
53 # proto area bind to their dependencies in the same proto area.
54
55
56 # Define all global variables (required for strict)
57 use vars qw($Prog $Env $Ena64 $Tmpdir $Gnuc);
58 use vars qw($LddNoU $Conf32 $Conf64);
59 use vars qw(%opt);
60 use vars qw($ErrFH $ErrTtl $InfoFH $InfoTtl $OutCnt1 $OutCnt2);
61
62 # An exception file is used to specify regular expressions to match
63 # objects. These directives specify special attributes of the object.
64 # The regular expressions are read from the file and compiled into the
65 # regular expression variables.
66 #
67 # The name of each regular expression variable is of the form
68 #
69 # $EXRE_xxx
70 #
71 # where xxx is the name of the exception in lower case. For example,
72 # the regular expression variable for EXEC_STACK is $EXRE_exec_stack.
73 #
74 # onbld_elfmod::LoadExceptionsToEXRE() depends on this naming convention
75 # to initialize the regular expression variables, and to detect invalid
76 # exception names.
77 #
416 if ($Sym && ($Line =~ /symbol not found/)) {
417 # Determine if this file is allowed undefined
418 # references.
419 if (($Sym == 5) && defined($EXRE_undef_ref) &&
420 ($RelPath =~ $EXRE_undef_ref)) {
421 $Sym = 0;
422 next;
423 }
424 if ($Sym-- == 1) {
425 onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath,
426 "continued ...") if !$opt{o};
427 next;
428 }
429 # Just print the symbol name.
430 $Line =~ s/$/\t<no -zdefs?>/;
431 onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath, $Line);
432 next;
433 }
434 # Look for any unused search paths.
435 if ($Line =~ /unused search path=/) {
436 # Note, skip this comparison for __GNUC builds, as the
437 # gnu compilers insert numerous unused search paths.
438 if ($Gnuc == 1) {
439 next;
440 }
441 next if defined($EXRE_unused_rpath) &&
442 ($Line =~ $EXRE_unused_rpath);
443
444 if ($Secure) {
445 $Line =~ s!$Tmpdir/!!;
446 }
447 $Line =~ s/^[ \t]*(.*)/\t$1\t<remove search path?>/;
448 onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath, $Line);
449 next;
450 }
451 # Look for unreferenced dependencies. Note, if any unreferenced
452 # objects are ignored, then set $UnDep so as to suppress any
453 # associated unused-object messages.
454 if ($Line =~ /unreferenced object=/) {
455 if (defined($EXRE_unref_obj) &&
456 ($Line =~ $EXRE_unref_obj)) {
457 $UnDep = 0;
458 next;
459 }
460 if ($Secure) {
1064 print "\n";
1065 print "\t[-D depfile]\testablish dependencies from 'find_elf -r' file list\n";
1066 print "\t[-d depdir]\testablish dependencies from under directory\n";
1067 print "\t[-E errfile]\tdirect error output to file\n";
1068 print "\t[-e exfile]\texceptions file\n";
1069 print "\t[-f listfile]\tuse file list produced by find_elf -r\n";
1070 print "\t[-I infofile]\tdirect informational output (-i, -v) to file\n";
1071 print "\t[-i]\t\tproduce dynamic table entry information\n";
1072 print "\t[-m]\t\tprocess mcs(1) comments\n";
1073 print "\t[-o]\t\tproduce one-liner output (prefixed with pathname)\n";
1074 print "\t[-s]\t\tprocess .stab and .symtab entries\n";
1075 print "\t[-v]\t\tprocess version definition entries\n";
1076 print "\t[-w outdir]\tinterpret all files relative to given directory\n";
1077 exit 1;
1078 }
1079
1080 die "$Prog: -D and -d options are mutually exclusive\n" if ($opt{D} && $opt{d});
1081
1082 $Tmpdir = "/tmp" if (!($Tmpdir = $ENV{TMPDIR}) || (! -d $Tmpdir));
1083
1084 # Determine whether this is a __GNUC build. If so, unused search path
1085 # processing is disabled.
1086 $Gnuc = defined $ENV{__GNUC} ? 1 : 0;
1087
1088 # If -w, change working directory to given location
1089 !$opt{w} || chdir($opt{w}) || die "$Prog: can't cd to $opt{w}";
1090
1091 # Locate and process the exceptions file
1092 onbld_elfmod::LoadExceptionsToEXRE('check_rtime');
1093
1094 # Is there a proto area available, either via the -d option, or because
1095 # we are part of an activated workspace?
1096 my $Proto;
1097 if ($opt{d}) {
1098 # User specified dependency directory - make sure it exists.
1099 -d $opt{d} || die "$Prog: $opt{d} is not a directory\n";
1100 $Proto = $opt{d};
1101 } elsif ($ENV{CODEMGR_WS}) {
1102 my $Root;
1103
1104 # Without a user specified dependency directory see if we're
1105 # part of a codemanager workspace and if a proto area exists.
1106 $Proto = $Root if ($Root = $ENV{ROOT}) && (-d $Root);
1107 }
|
37 #
38 # By default any file that has conditions that should be reported is first
39 # listed and then each condition follows. The -o (one-line) option produces a
40 # more terse output which is better for sorting/diffing with "nightly".
41 #
42 # NOTE: missing dependencies, symbols or versions are reported by running the
43 # file through ldd(1). As objects within a proto area are built to exist in a
44 # base system, standard use of ldd(1) will bind any objects to dependencies
45 # that exist in the base system. It is frequently the case that newer objects
46 # exist in the proto area that are required to satisfy other objects
47 # dependencies, and without using these newer objects an ldd(1) will produce
48 # misleading error messages. To compensate for this, the -D/-d options, or the
49 # existence of the CODEMSG_WS/ROOT environment variables, cause the creation of
50 # alternative dependency mappings via crle(1) configuration files that establish
51 # any proto shared objects as alternatives to their base system location. Thus
52 # ldd(1) can be executed against these configuration files so that objects in a
53 # proto area bind to their dependencies in the same proto area.
54
55
56 # Define all global variables (required for strict)
57 use vars qw($Prog $Env $Ena64 $Tmpdir);
58 use vars qw($LddNoU $Conf32 $Conf64);
59 use vars qw(%opt);
60 use vars qw($ErrFH $ErrTtl $InfoFH $InfoTtl $OutCnt1 $OutCnt2);
61
62 # An exception file is used to specify regular expressions to match
63 # objects. These directives specify special attributes of the object.
64 # The regular expressions are read from the file and compiled into the
65 # regular expression variables.
66 #
67 # The name of each regular expression variable is of the form
68 #
69 # $EXRE_xxx
70 #
71 # where xxx is the name of the exception in lower case. For example,
72 # the regular expression variable for EXEC_STACK is $EXRE_exec_stack.
73 #
74 # onbld_elfmod::LoadExceptionsToEXRE() depends on this naming convention
75 # to initialize the regular expression variables, and to detect invalid
76 # exception names.
77 #
416 if ($Sym && ($Line =~ /symbol not found/)) {
417 # Determine if this file is allowed undefined
418 # references.
419 if (($Sym == 5) && defined($EXRE_undef_ref) &&
420 ($RelPath =~ $EXRE_undef_ref)) {
421 $Sym = 0;
422 next;
423 }
424 if ($Sym-- == 1) {
425 onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath,
426 "continued ...") if !$opt{o};
427 next;
428 }
429 # Just print the symbol name.
430 $Line =~ s/$/\t<no -zdefs?>/;
431 onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath, $Line);
432 next;
433 }
434 # Look for any unused search paths.
435 if ($Line =~ /unused search path=/) {
436 next if defined($EXRE_unused_rpath) &&
437 ($Line =~ $EXRE_unused_rpath);
438
439 if ($Secure) {
440 $Line =~ s!$Tmpdir/!!;
441 }
442 $Line =~ s/^[ \t]*(.*)/\t$1\t<remove search path?>/;
443 onbld_elfmod::OutMsg($ErrFH, $ErrTtl, $RelPath, $Line);
444 next;
445 }
446 # Look for unreferenced dependencies. Note, if any unreferenced
447 # objects are ignored, then set $UnDep so as to suppress any
448 # associated unused-object messages.
449 if ($Line =~ /unreferenced object=/) {
450 if (defined($EXRE_unref_obj) &&
451 ($Line =~ $EXRE_unref_obj)) {
452 $UnDep = 0;
453 next;
454 }
455 if ($Secure) {
1059 print "\n";
1060 print "\t[-D depfile]\testablish dependencies from 'find_elf -r' file list\n";
1061 print "\t[-d depdir]\testablish dependencies from under directory\n";
1062 print "\t[-E errfile]\tdirect error output to file\n";
1063 print "\t[-e exfile]\texceptions file\n";
1064 print "\t[-f listfile]\tuse file list produced by find_elf -r\n";
1065 print "\t[-I infofile]\tdirect informational output (-i, -v) to file\n";
1066 print "\t[-i]\t\tproduce dynamic table entry information\n";
1067 print "\t[-m]\t\tprocess mcs(1) comments\n";
1068 print "\t[-o]\t\tproduce one-liner output (prefixed with pathname)\n";
1069 print "\t[-s]\t\tprocess .stab and .symtab entries\n";
1070 print "\t[-v]\t\tprocess version definition entries\n";
1071 print "\t[-w outdir]\tinterpret all files relative to given directory\n";
1072 exit 1;
1073 }
1074
1075 die "$Prog: -D and -d options are mutually exclusive\n" if ($opt{D} && $opt{d});
1076
1077 $Tmpdir = "/tmp" if (!($Tmpdir = $ENV{TMPDIR}) || (! -d $Tmpdir));
1078
1079 # If -w, change working directory to given location
1080 !$opt{w} || chdir($opt{w}) || die "$Prog: can't cd to $opt{w}";
1081
1082 # Locate and process the exceptions file
1083 onbld_elfmod::LoadExceptionsToEXRE('check_rtime');
1084
1085 # Is there a proto area available, either via the -d option, or because
1086 # we are part of an activated workspace?
1087 my $Proto;
1088 if ($opt{d}) {
1089 # User specified dependency directory - make sure it exists.
1090 -d $opt{d} || die "$Prog: $opt{d} is not a directory\n";
1091 $Proto = $opt{d};
1092 } elsif ($ENV{CODEMGR_WS}) {
1093 my $Root;
1094
1095 # Without a user specified dependency directory see if we're
1096 # part of a codemanager workspace and if a proto area exists.
1097 $Proto = $Root if ($Root = $ENV{ROOT}) && (-d $Root);
1098 }
|