| Revision 4809,
1.5 KB
checked in by sam, 13 months ago
(diff) |
|
Fix a weird problem with lib6 versioned symbols.
|
-
Property svn:keywords set to
Id
|
| Rev | Line | |
|---|
| [1470] | 1 | /* |
|---|
| 2 | * zzuf - general purpose fuzzer |
|---|
| [4253] | 3 | * Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net> |
|---|
| [1470] | 4 | * All Rights Reserved |
|---|
| 5 | * |
|---|
| 6 | * This program is free software. It comes without any warranty, to |
|---|
| 7 | * the extent permitted by applicable law. You can redistribute it |
|---|
| 8 | * and/or modify it under the terms of the Do What The Fuck You Want |
|---|
| 9 | * To Public License, Version 2, as published by Sam Hocevar. See |
|---|
| 10 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | /* |
|---|
| [1701] | 14 | * lib-load.h: preload library functions |
|---|
| [1470] | 15 | */ |
|---|
| 16 | |
|---|
| [1687] | 17 | /* Symbol loading stuff */ |
|---|
| [1494] | 18 | #define STR(x) #x |
|---|
| 19 | #define ORIG(x) x##_orig |
|---|
| [1470] | 20 | |
|---|
| [4657] | 21 | #if defined HAVE_DLFCN_H |
|---|
| [1695] | 22 | # include <dlfcn.h> |
|---|
| [1701] | 23 | # define NEW(x) x |
|---|
| [1695] | 24 | # define LOADSYM(x) \ |
|---|
| 25 | do { \ |
|---|
| 26 | if(!ORIG(x)) \ |
|---|
| [4152] | 27 | { \ |
|---|
| 28 | /* XXX: we try to initialise libzzuf as soon as possible, \ |
|---|
| 29 | * otherwise we may miss a lot of stuff if we wait for \ |
|---|
| 30 | * the linker to load us fully. */ \ |
|---|
| 31 | _zz_init(); \ |
|---|
| [4809] | 32 | extern void *_zz_dl_lib; \ |
|---|
| 33 | ORIG(x) = dlsym(_zz_dl_lib, STR(x)); \ |
|---|
| [4152] | 34 | } \ |
|---|
| [1695] | 35 | if(!ORIG(x)) \ |
|---|
| 36 | abort(); \ |
|---|
| 37 | } while(0) |
|---|
| [4657] | 38 | #elif defined _WIN32 |
|---|
| [1701] | 39 | # define NEW(x) x##_new |
|---|
| [1695] | 40 | # define LOADSYM(x) \ |
|---|
| 41 | do { \ |
|---|
| [4152] | 42 | /* Nothing to do under Windows, everything is done as soon \ |
|---|
| 43 | * as the process is launched. */ \ |
|---|
| [1695] | 44 | } while(0) |
|---|
| [4655] | 45 | |
|---|
| 46 | typedef struct |
|---|
| 47 | { |
|---|
| 48 | char const *lib, *name; |
|---|
| 49 | void **old; |
|---|
| 50 | void *new; |
|---|
| 51 | } |
|---|
| 52 | zzuf_table_t; |
|---|
| 53 | |
|---|
| [4663] | 54 | extern zzuf_table_t table_win32[]; |
|---|
| [4655] | 55 | |
|---|
| [4657] | 56 | #else |
|---|
| 57 | # error no function diversion system for this platform |
|---|
| [1695] | 58 | #endif |
|---|
| [4672] | 59 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.