When linking with no rtld support, provide stub dl*() functions that

just return errors.  This removes the need for awful hacks like that in
our build of libtcl which would get link errors when linked static.

John Polstra once mentioned that this was on his "todo" list.

Note that one can use:
  cc -Wl,-Bstatic -o foo foo.o
and get an executable that has it's libraries statically linked, but has
a fully functional runtime linker so the executable can call dlopen() and
have it work.  (I've tested this)
This commit is contained in:
Peter Wemm 1996-12-28 17:10:52 +00:00
parent 08d366cf6b
commit fbde87863d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20975

View File

@ -27,11 +27,13 @@
* (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.24 1996/10/01 00:54:48 peter Exp $
* $Id: crt0.c,v 1.25 1996/10/06 03:19:26 steve Exp $
*/
#include <sys/param.h>
#include <stdlib.h>
#include <dlfcn.h>
#ifdef DYNAMIC
#include <sys/types.h>
@ -382,8 +384,48 @@ _getenv(name)
asm(" movl $-1,%eax");
asm(" ret");
#else /* DYNAMIC */
/*
* DL stubs for static linking case (just return error)
*/
void *
dlopen(name, mode)
char *name;
int mode;
{
return NULL;
}
int
dlclose(fd)
void *fd;
{
return -1;
}
void *
dlsym(fd, name)
void *fd;
char *name;
{
return NULL;
}
char *
dlerror()
{
return "Service unavailable";
}
#endif /* DYNAMIC */
/*
* Support routines
*/
#ifdef MCRT0
asm (" .text");
asm ("_eprol:");