NetBSD Problem Report #39959

From marcotte@panix.com  Wed Nov 19 21:38:46 2008
Return-Path: <marcotte@panix.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id BCC7963BE2B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 19 Nov 2008 21:38:46 +0000 (UTC)
Message-Id: <20081119213845.3B9F624216@panix5.panix.com>
Date: Wed, 19 Nov 2008 16:38:45 -0500 (EST)
From: marcotte@panix.com
Reply-To: marcotte@panix.com
To: gnats-bugs@gnats.NetBSD.org
Subject: ld.elf_so breaks old perl
X-Send-Pr-Version: 3.95

>Number:         39959
>Category:       lib
>Synopsis:       ld.elf_so doesn't work with old perl
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 19 21:40:00 +0000 2008
>Closed-Date:    Thu Jan 07 15:04:33 +0000 2021
>Last-Modified:  Thu Jan 07 15:04:33 +0000 2021
>Originator:     Brian Marcotte
>Release:        NetBSD 5.0_BETA
>Organization:
	panix.com
>Environment:
System: NetBSD panix5.panix.com 5.0_BETA NetBSD 5.0_BETA (PANIX-XEN3U-USER) #0: Wed Nov 12 09:29:45 EST 2008 root@juggler.panix.com:/misc1/obj/misc2/devel/netbsd/5-beta/src/sys/arch/i386/compile/PANIX-XEN3U-USER i386
Architecture: i386
Machine: i386
>Description:
The ld.elf_so which comes with NetBSD 5 causes an old perl to fail with
this program:

	use Socket;

The perl is 5.6.1 compiled under NetBSD 1.5. Under the stock ld.elf_so,
this happens:

	Invalid shared object handle 0x1
	Can't find 'boot_Socket' symbol in
	/pkg/perl-5.6.1-elf/lib/perl-5.6.1/i386-netbsd/auto/Socket/Socket.so
	at /pkg/perl-5.6.1-elf/lib/perl-5.6.1/i386-netbsd/Socket.pm line 451
	Compilation failed in require at -e line 1.
	BEGIN failed--compilation aborted at -e line 1.

I have tracked this down to a change which happened on Jun 4, 2008:

	diff -u ld.so.2008060?/src/libexec/ld.elf_so/rtld.h
	--- 3/src/libexec/ld.elf_so/rtld.h 2008-01-14 03:52:16.000000000 -0500
	+++ 4/src/libexec/ld.elf_so/rtld.h 2008-06-03 15:32:32.000000000 -0400
	@@ -1,4 +1,4 @@
	-/*     $NetBSD: rtld.h,v 1.77 2008/01/14 08:52:16 yamt Exp $    */
	+/*     $NetBSD: rtld.h,v 1.78 2008/06/03 19:32:32 ad Exp $      */

	 /*
	  * Copyright 1996 John D. Polstra.
	@@ -130,6 +130,7 @@
	        caddr_t         entry;          /* Entry point */
	        const Elf_Phdr *__junk001;
	        size_t          pathlen;        /* Pathname length */
	+       void            *ehdr;

	        /* Items from the dynamic section. */
	        Elf_Addr       *pltgot;         /* PLTGOT table */

Even without the other changes that happened on that day, this one change
causes the perl to fail.

Before and after ktrace output is at the location below.

>How-To-Repeat:
I have the old perl packaged up here along with the patch I used and the
ktrace output:

	http://www.panix.com/~marcotte/ld.elf_so/

It should fail with just "use Socket".

>Fix:
I made it work by moving the new variable to the bottom of the structure.

I don't, however, understand the real problem or why this appears to fix
it.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 29 May 2019 01:06:16 +0000
State-Changed-Why:
I suspect this commit by skrll had the same intention: https://v4.freshbsd.org/commit/netbsd/src/78fb74a9ac54435f85cad990799758e024a1899b4ada5e9b439751a3ddcf1049
rtld.h:1.88 Restore backwards compatibility for binaries referencing the main
   Obj_Entry.


State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Thu, 07 Jan 2021 15:04:33 +0000
State-Changed-Why:
Feedback timeout. Assuming fixed based on there being a commit that looks like it would fix it.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.