diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 45447e3..22a76cf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1246,7 +1246,8 @@ python package_do_shlibs() {
 				if not this_soname in sonames:
 					# if library is private (only used by package) then do not build shlib for it
 					if not private_libs or -1 == private_libs.find(this_soname):
-						sonames.append(this_soname)
+						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
+							sonames.append(this_soname)
 				if libdir_re.match(root):
 					needs_ldconfig = True
 				if snap_symlinks and (file != this_soname):
@@ -1328,6 +1329,8 @@ python package_do_shlibs() {
 	shlib_provider = {}
 	private_libs = d.getVar('PRIVATE_LIBS', True)
 	for pkg in packages.split():
+		if not private_libs:
+			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
 		needs_ldconfig = False
 		bb.debug(2, "calculating shlib provides for %s" % pkg)
 
