summaryrefslogtreecommitdiffstats
path: root/lib/csu/i386
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1995-09-27 23:13:33 +0000
committernate <nate@FreeBSD.org>1995-09-27 23:13:33 +0000
commitf12729acb8ecbd618c3c778035349a964e1586a6 (patch)
tree51c70b260239d4721e155b1bb40242faff292053 /lib/csu/i386
parentda12a17f8e9410107abb07fa8e8dc55cdfddc6da (diff)
downloadFreeBSD-src-f12729acb8ecbd618c3c778035349a964e1586a6.zip
FreeBSD-src-f12729acb8ecbd618c3c778035349a964e1586a6.tar.gz
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)
Diffstat (limited to 'lib/csu/i386')
-rw-r--r--lib/csu/i386/crt0.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c
index 7959e66..e42e21f 100644
--- a/lib/csu/i386/crt0.c
+++ b/lib/csu/i386/crt0.c
@@ -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;
OpenPOWER on IntegriCloud