source: rtems/testsuites/libtests/dl06/dl06-o1.c @ f59d435d

Last change on this file since f59d435d was 86e79d7, checked in by Chris Johns <chrisj@…>, on Apr 12, 2018 at 4:52:36 AM

testsuites/dl06: Add a test for RAP format.

This test loads a RAP format file that contains calls that are not
in the kernel and linked from libm. It uses and test rtems-ld.

Update #2769

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>.  All rights reserved.
3 *
4 * The license and distribution terms for this file may be
5 * found in the file LICENSE in this distribution or at
6 * http://www.rtems.org/license/LICENSE.
7 */
8
9#include "dl06-o2.h"
10
11#include <dlfcn.h>
12#include <math.h>
13
14#include <rtems/test.h>
15
16#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
17
18typedef void (*func1_t)(unsigned short s[7]);
19
20static void* find_sym(const char* name)
21{
22  void* sym = dlsym(RTLD_DEFAULT, name);
23  if (sym == NULL)
24    printf("dlsym failed: not found: %s\n", name);
25  return sym;
26}
27
28/*
29 * Yes a decl in the source. This is a modules main and I could not find which
30 * header main is defined in.
31 */
32int rtems_main (int argc, const char* argv[]);
33
34int rtems_main (int argc, const char* argv[])
35{
36  func1_t        f1;
37  int            arg;
38  double         d;
39  unsigned short s[7] = { 12, 34, 56, 78, 90, 13, 57 };
40
41  printf("Loaded module: argc:%d [%s]\n", argc, __FILE__);
42
43  f1 = find_sym ("dl_o2_func1");
44  if (f1 == NULL)
45    return 0;
46
47  f1 (s);
48
49  d = dl_o2_func2 (7.1, 33.0);
50  d = dl_o2_func3 (0.778899);
51
52  return argc;
53}
Note: See TracBrowser for help on using the repository browser.