diff options
Diffstat (limited to 'testsuites/libtests/dl09/dl-load.c')
-rw-r--r-- | testsuites/libtests/dl09/dl-load.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/testsuites/libtests/dl09/dl-load.c b/testsuites/libtests/dl09/dl-load.c index 9b03a3746c..216fb5a201 100644 --- a/testsuites/libtests/dl09/dl-load.c +++ b/testsuites/libtests/dl09/dl-load.c @@ -1,10 +1,29 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* * Copyright (c) 2019 Chris Johns <chrisj@rtems.org>. * All rights reserved. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #define TEST_TRACE 0 @@ -97,8 +116,12 @@ static void dl_check_resolved(void* handle, bool has_unresolved) rtems_test_assert (unresolved == 0); } } - printf ("handel: %p: %sunresolved externals\n", - handle, unresolved != 0 ? "" : "no "); + if (handle == RTLD_SELF) + printf ("handle: RTL_SELF: %sunresolved externals\n", + unresolved != 0 ? "" : "no "); + else + printf ("handle: %p: %sunresolved externals\n", + handle, unresolved != 0 ? "" : "no "); } static void* dl_load_obj (const char* name, bool has_unresolved) @@ -133,12 +156,20 @@ static void dl_close (void* handle) static int dl_call (void* handle, const char* func) { + static call_sig last_call; call_sig call = dlsym (handle, func); if (call == NULL) { printf("dlsym failed: symbol not found: %s\n", func); return 1; } + if (last_call != NULL && last_call != call) + { + printf("Call location different: moved by: %i (call:%p last:%p)\n", + (int) (call - last_call), + call, last_call); + } + last_call = call; call (); return 0; } @@ -152,7 +183,7 @@ static void dl_object_open (object_def* od, objects* o) if (od->space != 0) { o->space = malloc (od->space); - printf("space alloc: %s: %d: %p\n", od->name, od->space, o->space); + printf("space alloc: %s: %zd: %p\n", od->name, od->space, o->space); rtems_test_assert (o->space != NULL); } dl_load_dump (); |