diff options
Diffstat (limited to 'load.c')
-rw-r--r-- | load.c | 37 |
1 files changed, 26 insertions, 11 deletions
@@ -1,5 +1,5 @@ /* Loading dynamic objects for GNU Make. -Copyright (C) 2012-2013 Free Software Foundation, Inc. +Copyright (C) 2012-2014 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify it under the @@ -30,6 +30,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */ #include "filedef.h" #include "variable.h" +/* Tru64 V4.0 does not have this flag */ +#ifndef RTLD_GLOBAL +# define RTLD_GLOBAL 0 +#endif + struct load_list { struct load_list *next; @@ -50,7 +55,10 @@ load_object (const gmk_floc *flocp, int noerror, { global_dl = dlopen (NULL, RTLD_NOW|RTLD_GLOBAL); if (! global_dl) - fatal (flocp, _("Failed to open global symbol table: %s"), dlerror ()); + { + const char *err = dlerror (); + OS (fatal, flocp, _("Failed to open global symbol table: %s"), err); + } } symp = (load_func_t) dlsym (global_dl, symname); @@ -74,23 +82,28 @@ load_object (const gmk_floc *flocp, int noerror, /* Still no? Then fail. */ if (! dlp) { + const char *err = dlerror (); if (noerror) - DB (DB_BASIC, ("%s", dlerror ())); + DB (DB_BASIC, ("%s", err)); else - error (flocp, "%s", dlerror ()); + OS (error, flocp, "%s", err); return NULL; } /* Assert that the GPL license symbol is defined. */ symp = (load_func_t) dlsym (dlp, "plugin_is_GPL_compatible"); if (! symp) - fatal (flocp, _("Loaded object %s is not declared to be GPL compatible"), - ldname); + OS (fatal, flocp, + _("Loaded object %s is not declared to be GPL compatible"), + ldname); symp = (load_func_t) dlsym (dlp, symname); if (! symp) - fatal (flocp, _("Failed to load symbol %s from %s: %s"), - symname, ldname, dlerror ()); + { + const char *err = dlerror (); + OSSS (fatal, flocp, _("Failed to load symbol %s from %s: %s"), + symname, ldname, err); + } /* Add this symbol to a trivial lookup table. This is not efficient but it's highly unlikely we'll be loading lots of objects, and we only @@ -133,12 +146,13 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror) ++fp; if (fp == ep) - fatal (flocp, _("Empty symbol name for load: %s"), *ldname); + OS (fatal, flocp, _("Empty symbol name for load: %s"), *ldname); /* Make a copy of the ldname part. */ memcpy (new, *ldname, l); new[l] = '\0'; *ldname = new; + nmlen = l; /* Make a copy of the symbol name part. */ symname = new + l + 1; @@ -226,7 +240,8 @@ int load_file (const gmk_floc *flocp, const char **ldname, int noerror) { if (! noerror) - fatal (flocp, _("The 'load' operation is not supported on this platform.")); + O (fatal, flocp, + _("The 'load' operation is not supported on this platform.")); return 0; } @@ -234,7 +249,7 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror) void unload_file (const char *name) { - fatal (NILF, "INTERNAL: Cannot unload when load is not supported!"); + O (fatal, NILF, "INTERNAL: Cannot unload when load is not supported!"); } #endif /* MAKE_LOAD */ |