changeset 9930:6a35d0df7374

6853216 ABI checker is broken by 6821619
author Ali Bahrami <Ali.Bahrami@Sun.COM>
date Mon, 22 Jun 2009 12:32:01 -0600
parents 599830c9c53e
children 75d4c33cfffa
files usr/src/tools/abi/etc/ABI_i386.db usr/src/tools/abi/etc/ABI_sparc.db usr/src/tools/abi/etc/exceptions usr/src/tools/abi/scripts/intf_check.pl
diffstat 4 files changed, 40 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/tools/abi/etc/ABI_i386.db	Mon Jun 22 11:10:05 2009 -0700
+++ b/usr/src/tools/abi/etc/ABI_i386.db	Mon Jun 22 12:32:01 2009 -0600
@@ -1,5 +1,5 @@
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # CDDL HEADER START
@@ -21,8 +21,6 @@
 #
 # CDDL HEADER END
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 #Releases:on998-gate,on998-patch,on28-gate,on28-patch,on81-gate,on81-patch,on10_gate
 AL usr/ucblib/libcurses.so.1 1 4 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
 AL usr/ucblib/amd64/libcurses.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
@@ -22287,6 +22285,9 @@
 elf_getident usr/lib/libelf.so.1 0 0 SUNW_1.2 SUNW_0.7 0 0 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0
 elf_getident lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 elf_getident lib/amd64/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
+elf_getphnum usr/lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0001111 0001010 0 0000101 0 0 0 0
+elf_getphnum lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000001 0000001 0 0 0 0 0 0
+elf_getphnum lib/amd64/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000001 0000001 0 0 0 0 0 0
 elf_getscn usr/lib/libelf.so.1 0 0 SUNW_1.2 SUNW_0.7 0 0 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0
 elf_getscn lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 elf_getscn lib/amd64/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
--- a/usr/src/tools/abi/etc/ABI_sparc.db	Mon Jun 22 11:10:05 2009 -0700
+++ b/usr/src/tools/abi/etc/ABI_sparc.db	Mon Jun 22 12:32:01 2009 -0600
@@ -27025,6 +27025,10 @@
 elf_getident usr/lib/libelf.so.1 0 0 SUNW_1.2 SUNW_0.7 SUNW_1.4 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 elf_getident lib/sparcv9/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 elf_getident lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
+elf_getphnum usr/lib/sparcv9/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0111111 0101010 0 0010101 0 0 0 0
+elf_getphnum usr/lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0111111 0101010 0 0010101 0 0 0 0
+elf_getphnum lib/sparcv9/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000001 0000001 0 0 0 0 0 0
+elf_getphnum lib/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000001 0000001 0 0 0 0 0 0
 elf_getscn usr/lib/sparcv9/libelf.so.1 0 0 SUNW_1.2 SUNW_0.7 SUNW_1.4 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 elf_getscn usr/lib/libelf.so.1 0 0 SUNW_1.2 SUNW_0.7 SUNW_1.4 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 SUNW_1.3 SUNW_0.7 SUNW_1.5 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 elf_getscn lib/sparcv9/libelf.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.5 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
--- a/usr/src/tools/abi/etc/exceptions	Mon Jun 22 11:10:05 2009 -0700
+++ b/usr/src/tools/abi/etc/exceptions	Mon Jun 22 12:32:01 2009 -0600
@@ -151,6 +151,9 @@
 # ERRORs exempted from RULE E7 (See RULES section of intf_check manpage) 
 # exempts libraries which have inconsistent version increments
 #############################################
+PSARC 2009/363: RULE E7: lib/libelf.so.1
+PSARC 2009/363: RULE E7: lib/amd64/libelf.so.1
+PSARC 2009/363: RULE E7: lib/sparcv9/libelf.so.1
 
 #############################################
 # ERRORs exempted from RULE E8 (See RULES section of intf_check manpage)
--- a/usr/src/tools/abi/scripts/intf_check.pl	Mon Jun 22 11:10:05 2009 -0700
+++ b/usr/src/tools/abi/scripts/intf_check.pl	Mon Jun 22 12:32:01 2009 -0600
@@ -3,9 +3,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -21,11 +20,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # Check versioning information.
 #
 # This script descends a directory hierarchy inspecting ELF shared objects for
@@ -625,7 +622,7 @@
 {
 	my ($FullPath, $RelPath) = @_;
 	my (@Elf, @Pvs, @Vers, @Syms);
-	my ($Aud, $Man, $Max, $Priv, $Pub, $Def, $Val, $Cls);
+	my ($Aud, $Man, $Max, $Priv, $Pub, $ElfCnt, $Val);
 	my ($RelPath_File, $LibName, $Name, $File);
 
 	if ($RelPath =~ $SkipProfile) {
@@ -647,49 +644,29 @@
 	$Aud = "$Auddir/$LibName";
 
 	# Determine whether we have a shared object, and whether version
-	# definitions exist.
-	@Elf = split(/\n/, `elfdump -ed '$FullPath' 2>&1`);
-
-	$Val = $Def = 0;
-	foreach my $Line (@Elf) {
-		$Val++;
-
-		# If we have an invalid file type, which we can tell from the
-		# first line, bail.
-		if (($Val == 1) && ($Line =~ /invalid file/)) {
-			return;
-		}
-
-		# Look for the ei_class (line 4) for man page processing.
-		if ($Val == 4) {
-			if ($Line !~ /ei_class:/) {
-				return;
-			}
-			if ($Line =~ /ELFCLASS32/) {
-				$Cls = "-32";
-			} else {
-				$Cls = "-64";
-			}
-		}
-
-		# Look for the e_type field (line 6) which indicates whether
-		# this file is a shared object (ET_DYN).
-		if ($Val == 6) {
-			if ($Line !~ /e_type:/) {
-				return;
-			}
-			if ($Line !~ /ET_DYN/) {
-				return;
-			}
-			next;
-		}
-
-		# Look for the dynamic section (occurs after line 11) and
-		# whether version definitions exist.
-		if (($Val > 11) && ($Line =~ /VERDEF/)) {
-			$Def = 1;
-			last;
-		}
+	# definitions exist. We use elfedit to do this, executing three
+	# commands in order, to produce a 0, 2, or 3 element output array.
+	#
+	#	Command                 Meaning
+	#	-----------------------------------------------
+	#	ehdr:ei_class		ELFCLASS of object
+	#	ehdr:ei_e_type		Type of object
+	#	dyn:tag verdef		Address of verdef items
+	#
+	# We discard stderr, and simply examine the resulting array to
+	# determine the situation:
+	#
+	#	# Array Elements	Meaning
+	#	-----------------------------------------------
+	#	  0			File is not ELF object
+	#	  2			Object with no versions (no VERDEF)
+	#	  3			Object that has versions
+	my $ecmd = "elfedit -r -o simple -e ehdr:ei_class -e ehdr:e_type" .
+	    " -e 'dyn:tag verdef'";
+	@Elf = split(/\n/, `$ecmd $FullPath 2>/dev/null`);
+	$ElfCnt = scalar @Elf;
+	if (($ElfCnt == 0) || ($Elf[1] ne 'ET_DYN')) {
+		return;
 	}
 
 	# Does this object follow the runtime versioned name convention?
@@ -702,7 +679,7 @@
 	}
 
 	# If there are no versions in the file we're done.
-	if (($Def eq 0) && !$opt{s} && !$opt{g}) {
+	if (($ElfCnt != 3) && !$opt{s} && !$opt{g}) {
 		OutMsg($Name, "no versions found", "WARNING");
 		return;
 	}
@@ -941,7 +918,7 @@
 			$Line =~ s/^\.//;
 			$Line =~ s/\.so\.\d+/.so/;
 
-			if ($Cls eq "-32") {
+			if ($Elf[0] eq 'ELFCLASS32') {
 				if (!$Pub32) {
 					$Pub32 = "$IntfDir/Public-32";
 					open(PUB32, "> $Pub32") or die