2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * Extremely simple dynamic loader, must never be linked with anything other
12 * than the standard C library. Its purpose is to try to load a dynamic module
13 * and verify the presence of one symbol, if that's given.
18 #include <openssl/core.h>
19 #include "simpledynamic.h"
21 static int test_load(const char *path, const char *symbol)
28 if (!sd_load(path, &sd, SD_MODULE))
30 ret = symbol == NULL || sd_sym(sd, symbol, &sym);
35 fprintf(stderr, "No dynamic loader\n");
40 int main(int argc, char *argv[])
44 if (argc != 2 && argc != 3) {
45 fprintf(stderr, "Usage: %s sharedobject [ entrypoint ]\n", argv[0]);
50 s = argc == 3 ? argv[2] : NULL;
52 return test_load(m, s) ? 0 : 1;