1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

ld.so: Introduce struct dl_exception

This commit separates allocating and raising exceptions.  This
simplifies catching and re-raising them because it is no longer
necessary to make a temporary, on-stack copy of the exception message.
This commit is contained in:
Florian Weimer
2017-08-10 13:40:22 +02:00
parent f87cc2bfba
commit 2449ae7b2d
29 changed files with 529 additions and 239 deletions

View File

@ -119,26 +119,11 @@ do_sym (void *handle, const char *name, void *who,
args.refp = &ref;
THREAD_GSCOPE_SET_FLAG ();
const char *objname;
const char *errstring = NULL;
bool malloced;
int err = _dl_catch_error (&objname, &errstring, &malloced,
call_dl_lookup, &args);
struct dl_exception exception;
int err = _dl_catch_exception (&exception, call_dl_lookup, &args);
THREAD_GSCOPE_RESET_FLAG ();
if (__glibc_unlikely (errstring != NULL))
{
/* The lookup was unsuccessful. Rethrow the error. */
char *errstring_dup = strdupa (errstring);
char *objname_dup = strdupa (objname);
if (malloced)
free ((char *) errstring);
_dl_signal_error (err, objname_dup, NULL, errstring_dup);
/* NOTREACHED */
}
if (__glibc_unlikely (exception.errstring != NULL))
_dl_signal_exception (err, &exception, NULL);
result = args.map;
}