Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Oct 2017 15:16:22 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324558 - in head/sys/boot: arm/uboot libsa mips/uboot powerpc/ofw powerpc/uboot
Message-ID:  <201710121516.v9CFGMeI045985@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710121516.v9CFGMeI045985>