Author: imp
Date: Thu Oct 12 15:16:22 2017
New Revision: 324558
URL: https://svnweb.freebsd.org/changeset/base/324558

Log:
  Define prototype for exit and ensure references
  
  Define a prototype for exit in stand.h. Provide a reference to exit in
  a few conf.c files to ensure that its definition gets pulled in early.
  Since exit() is a MD routine, it isn't defined in libsa. However,
  libsa tends to be listed last and will soon have panic() in it which
  calls exit(). The reference to exit early ensures that the MD exit is
  available to satisfy linking for static libraries.

Modified:
  head/sys/boot/arm/uboot/conf.c
  head/sys/boot/libsa/stand.h
  head/sys/boot/mips/uboot/conf.c
  head/sys/boot/powerpc/ofw/conf.c
  head/sys/boot/powerpc/uboot/conf.c

Modified: head/sys/boot/arm/uboot/conf.c
==============================================================================
--- head/sys/boot/arm/uboot/conf.c      Thu Oct 12 15:16:16 2017        
(r324557)
+++ head/sys/boot/arm/uboot/conf.c      Thu Oct 12 15:16:22 2017        
(r324558)
@@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$");
 #include "dev_net.h"
 #endif
 
+/* Make sure we have an explicit reference to exit so libsa's panic pulls in 
the MD exit */
+void (*exitfn)(int) = exit;
+
 struct devsw *devsw[] = {
 #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
        &uboot_storage,

Modified: head/sys/boot/libsa/stand.h
==============================================================================
--- head/sys/boot/libsa/stand.h Thu Oct 12 15:16:16 2017        (r324557)
+++ head/sys/boot/libsa/stand.h Thu Oct 12 15:16:22 2017        (r324558)
@@ -376,6 +376,7 @@ extern int  null_readdir(struct open_file *f, struct di
  * Machine dependent functions and data, must be provided or stubbed by 
  * the consumer 
  */
+extern void            exit(int);
 extern int             getchar(void);
 extern int             ischar(void);
 extern void            putchar(int);

Modified: head/sys/boot/mips/uboot/conf.c
==============================================================================
--- head/sys/boot/mips/uboot/conf.c     Thu Oct 12 15:16:16 2017        
(r324557)
+++ head/sys/boot/mips/uboot/conf.c     Thu Oct 12 15:16:22 2017        
(r324558)
@@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$");
 #include "dev_net.h"
 #endif
 
+/* Make sure we have an explicit reference to exit so libsa's panic pulls in 
the MD exit */
+void (*exitfn)(int) = exit;
+
 struct devsw *devsw[] = {
 #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
        &uboot_storage,

Modified: head/sys/boot/powerpc/ofw/conf.c
==============================================================================
--- head/sys/boot/powerpc/ofw/conf.c    Thu Oct 12 15:16:16 2017        
(r324557)
+++ head/sys/boot/powerpc/ofw/conf.c    Thu Oct 12 15:16:22 2017        
(r324558)
@@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$");
 #include "dev_net.h"
 #endif
 
+/* Make sure we have an explicit reference to exit so libsa's panic pulls in 
the MD exit */
+void (*exitfn)(int) = exit;
+
 /*
  * We could use linker sets for some or all of these, but
  * then we would have to control what ended up linked into

Modified: head/sys/boot/powerpc/uboot/conf.c
==============================================================================
--- head/sys/boot/powerpc/uboot/conf.c  Thu Oct 12 15:16:16 2017        
(r324557)
+++ head/sys/boot/powerpc/uboot/conf.c  Thu Oct 12 15:16:22 2017        
(r324558)
@@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$");
 #include "dev_net.h"
 #endif
 
+/* Make sure we have an explicit reference to exit so libsa's panic pulls in 
the MD exit */
+void (*exitfn)(int) = exit;
+
 /*
  * We could use linker sets for some or all of these, but
  * then we would have to control what ended up linked into
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to