11b5d61b8Smrg/* 21b5d61b8Smrg * Copyright © 2017 Broadcom 31b5d61b8Smrg * 41b5d61b8Smrg * Permission is hereby granted, free of charge, to any person obtaining a 51b5d61b8Smrg * copy of this software and associated documentation files (the "Software"), 61b5d61b8Smrg * to deal in the Software without restriction, including without limitation 71b5d61b8Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 81b5d61b8Smrg * and/or sell copies of the Software, and to permit persons to whom the 91b5d61b8Smrg * Software is furnished to do so, subject to the following conditions: 101b5d61b8Smrg * 111b5d61b8Smrg * The above copyright notice and this permission notice (including the next 121b5d61b8Smrg * paragraph) shall be included in all copies or substantial portions of the 131b5d61b8Smrg * Software. 141b5d61b8Smrg * 151b5d61b8Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 161b5d61b8Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 171b5d61b8Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 181b5d61b8Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 191b5d61b8Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 201b5d61b8Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 211b5d61b8Smrg * IN THE SOFTWARE. 221b5d61b8Smrg */ 231b5d61b8Smrg 241b5d61b8Smrg/* Small test program to see if we can successfully resolve all 251b5d61b8Smrg * symbols of a set of X.Org modules when they're loaded in order. 261b5d61b8Smrg */ 271b5d61b8Smrg 281b5d61b8Smrg#include <stdio.h> 291b5d61b8Smrg#include <stdlib.h> 301b5d61b8Smrg#include <dlfcn.h> 311b5d61b8Smrg 321b5d61b8Smrgint main (int argc, char**argv) 331b5d61b8Smrg{ 341b5d61b8Smrg void *ret; 351b5d61b8Smrg 361b5d61b8Smrg if (argc < 2) { 371b5d61b8Smrg fprintf(stderr, 381b5d61b8Smrg "Must pass path any modules to be loaded.\n"); 391b5d61b8Smrg exit(1); 401b5d61b8Smrg } 411b5d61b8Smrg 421b5d61b8Smrg for (int i = 1; i < argc; i++) { 431b5d61b8Smrg fprintf(stderr, "opening %s\n", argv[i]); 441b5d61b8Smrg ret = dlopen(argv[i], RTLD_GLOBAL | RTLD_NOW); 451b5d61b8Smrg if (!ret) { 461b5d61b8Smrg fprintf(stderr, "dlopen error: %s\n", dlerror()); 471b5d61b8Smrg exit(1); 481b5d61b8Smrg } 491b5d61b8Smrg } 501b5d61b8Smrg 511b5d61b8Smrg return 0; 521b5d61b8Smrg} 53