Fixup the "ld.so failed" message for the case when ld.so finds undefined
symbols. An easy example to see this is to develop an X program which links against Xt, but doesn't add -lX11 to the link line. It will link fine, but cause run-time errors by ld.so because of missing symbols used by Xt defined in X11. This patch makes the errors more readable. Submitted by: jdp@polstra.com (John Polstra)
This commit is contained in:
parent
0df28190d4
commit
b80e157e60
@ -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: crt0.c,v 1.16 1995/02/24 07:51:13 phk Exp $
|
||||
* $Id: crt0.c,v 1.17 1995/06/27 09:53:27 dfr Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -117,9 +117,9 @@ char *__progname = empty;
|
||||
__syscall(SYS_mmap, (caddr_t)(addr), (size_t)(len), (int)(prot), (int)(flags), (int)(fd), (long)0L, (off_t)(off))
|
||||
#endif
|
||||
|
||||
#define _FATAL(str) \
|
||||
write(2, str, sizeof(str) - 1), \
|
||||
_exit(1);
|
||||
#define _PUTNMSG(str, len) write(2, (str), (len))
|
||||
#define _PUTMSG(str) _PUTNMSG((str), sizeof (str) - 1)
|
||||
#define _FATAL(str) ( _PUTMSG(str), _exit(1) )
|
||||
|
||||
|
||||
start()
|
||||
@ -262,7 +262,18 @@ __do_dynamic_link ()
|
||||
entry = (int (*)())(crt.crt_ba + sizeof hdr);
|
||||
ret = (*entry)(CRT_VERSION_BSD_3, &crt);
|
||||
if (ret == -1) {
|
||||
_FATAL("ld.so failed\n");
|
||||
_PUTMSG("ld.so failed");
|
||||
if(_DYNAMIC.d_entry != NULL) {
|
||||
char *msg = (_DYNAMIC.d_entry->dlerror)();
|
||||
if(msg != NULL) {
|
||||
char *endp;
|
||||
_PUTMSG(": ");
|
||||
for(endp = msg; *endp != '\0'; ++endp)
|
||||
; /* Find the end */
|
||||
_PUTNMSG(msg, endp - msg);
|
||||
}
|
||||
}
|
||||
_FATAL("\n");
|
||||
}
|
||||
|
||||
ld_entry = _DYNAMIC.d_entry;
|
||||
|
Loading…
Reference in New Issue
Block a user