Don't recognize a file as an a.out shared library unless it has at

least 2 version numbers.  This fixes the bug where the dynamic
linker would try to load an ELF shared library if it found one.

Note, this change also fixes the same thing in "ld", because the
code is shared.

For "ld" there is still a problem with ".a" libraries, which cannot
be distinguished by name.  I haven't decided what, if anything, to
do about that.
This commit is contained in:
John Polstra 1998-09-05 20:28:48 +00:00
parent e99ea9ec2b
commit a3bd401942
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38870

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: shlib.c,v 1.19 1998/05/26 20:12:49 sos Exp $
* $Id: shlib.c,v 1.20 1998/06/07 03:53:08 brian Exp $
*/
#include <sys/param.h>
@ -301,15 +301,14 @@ search_lib_dir(dir, name, majorp, minorp, do_dot_a)
int cur_ndewey;
cur_ndewey = getdewey(cur_dewey, extension+3);
if(cur_ndewey == 0) /* No version number */
if(cur_ndewey < 2) /* Too few version numbers */
continue;
if(*majorp != -1) { /* Need exact match on major */
if(cur_dewey[0] != *majorp)
continue;
if(*minorp != -1) { /* Need minor >= minimum */
if(cur_ndewey < 2 ||
cur_dewey[1] < *minorp)
if(cur_dewey[1] < *minorp)
continue;
}
}
@ -330,8 +329,7 @@ search_lib_dir(dir, name, majorp, minorp, do_dot_a)
if(dot_so_name[0] != '\0') {
*majorp = best_dewey[0];
if(best_ndewey >= 2)
*minorp = best_dewey[1];
*minorp = best_dewey[1];
return concat(dir, "/", dot_so_name);
}