From 0c2eaf5082a30fb06bad553775e805a745d59ee2 Mon Sep 17 00:00:00 2001
From: theuni <theuni-nospam@xbmc.org>
Date: Tue, 22 Jan 2013 04:09:07 -0500
Subject: [PATCH] depends: mark our wrapped functions as used

otherwise they get stripped when enabling dead code stripping
---
 xbmc/cores/DllLoader/exports/wrapper.c | 138 ++++++++++++++++-----------------
 1 file changed, 69 insertions(+), 69 deletions(-)

diff -Naur xbmc-f81d56e/xbmc/cores/DllLoader/exports/wrapper.c xbmc-f81d56e.patch/xbmc/cores/DllLoader/exports/wrapper.c
--- xbmc-f81d56e/xbmc/cores/DllLoader/exports/wrapper.c	2013-05-18 12:30:19.000000000 +0200
+++ xbmc-f81d56e.patch/xbmc/cores/DllLoader/exports/wrapper.c	2013-05-18 16:55:55.222087716 +0200
@@ -115,7 +115,7 @@
 int dll_setvbuf(FILE *stream, char *buf, int type, size_t size);
 struct mntent *dll_getmntent(FILE *fp);
 
-void *__wrap_dlopen(const char *filename, int flag)
+__attribute__((used)) void *__wrap_dlopen(const char *filename, int flag)
 {
 #if defined(TARGET_ANDROID)
   return dll_dlopen(filename, flag);
@@ -124,213 +124,213 @@
 #endif
 }
 
-FILE *__wrap_popen(const char *command, const char *mode)
+__attribute__((used)) FILE *__wrap_popen(const char *command, const char *mode)
 {
   return dll_popen(command, mode);
 }
 
-void* __wrap_calloc( size_t num, size_t size )
+__attribute__((used)) void* __wrap_calloc( size_t num, size_t size )
 {
   return dllcalloc(num, size);
 }
 
-void* __wrap_malloc(size_t size)
+__attribute__((used)) void* __wrap_malloc(size_t size)
 {
   return dllmalloc(size);
 }
 
-void* __wrap_realloc( void *memblock, size_t size )
+__attribute__((used)) void* __wrap_realloc( void *memblock, size_t size )
 {
   return dllrealloc(memblock, size);
 }
 
-void __wrap_free( void* pPtr )
+__attribute__((used)) void __wrap_free( void* pPtr )
 {
   dllfree(pPtr);
 }
 
-int __wrap_open(const char *file, int oflag, ...)
+__attribute__((used)) int __wrap_open(const char *file, int oflag, ...)
 {
   return dll_open(file, oflag);
 }
 
-int __wrap_open64(const char *file, int oflag, ...)
+__attribute__((used)) int __wrap_open64(const char *file, int oflag, ...)
 {
   return dll_open(file, oflag);
 }
 
-int __wrap_close(int fd)
+__attribute__((used)) int __wrap_close(int fd)
 {
    return dll_close(fd);
 }
 
-ssize_t __wrap_write(int fd, const void *buf, size_t count)
+__attribute__((used)) ssize_t __wrap_write(int fd, const void *buf, size_t count)
 {
   return dll_write(fd, buf, count);
 }
 
-ssize_t __wrap_read(int fd, void *buf, size_t count)
+__attribute__((used)) ssize_t __wrap_read(int fd, void *buf, size_t count)
 {
   return dll_read(fd, buf, count);
 }
 
-__off_t __wrap_lseek(int fildes, __off_t offset, int whence)
+__attribute__((used)) __off_t __wrap_lseek(int fildes, __off_t offset, int whence)
 {
   return dll_lseek(fildes, offset, whence);
 }
 
-__off64_t __wrap_lseek64(int fildes, __off64_t offset, int whence)
+__attribute__((used)) __off64_t __wrap_lseek64(int fildes, __off64_t offset, int whence)
 {
   __off64_t seekRes = dll_lseeki64(fildes, offset, whence);
   return seekRes;
 }
 
-int __wrap_fclose(FILE *fp)
+__attribute__((used)) int __wrap_fclose(FILE *fp)
 {
   return dll_fclose(fp);
 }
 
-int __wrap_ferror(FILE *stream)
+__attribute__((used)) int __wrap_ferror(FILE *stream)
 {
   return dll_ferror(stream);
 }
 
-void __wrap_clearerr(FILE *stream)
+__attribute__((used)) void __wrap_clearerr(FILE *stream)
 {
   return dll_clearerr(stream);
 }
 
-int __wrap_feof(FILE *stream)
+__attribute__((used)) int __wrap_feof(FILE *stream)
 {
   return dll_feof(stream);
 }
 
-int __wrap_fileno(FILE *stream)
+__attribute__((used)) int __wrap_fileno(FILE *stream)
 {
   return dll_fileno(stream);
 }
 
-FILE *__wrap_fopen(const char *path, const char *mode)
+__attribute__((used)) FILE *__wrap_fopen(const char *path, const char *mode)
 {
   return dll_fopen(path, mode);
 }
 
-FILE *__wrap_fopen64(const char *path, const char *mode)
+__attribute__((used)) FILE *__wrap_fopen64(const char *path, const char *mode)
 {
   return dll_fopen(path, mode);
 }
 
-FILE *__wrap_fdopen(int fildes, const char *mode)
+__attribute__((used)) FILE *__wrap_fdopen(int fildes, const char *mode)
 {
   return dll_fdopen(fildes, mode);
 }
 
-FILE *__wrap_freopen(const char *path, const char *mode, FILE *stream)
+__attribute__((used)) FILE *__wrap_freopen(const char *path, const char *mode, FILE *stream)
 {
   return dll_freopen(path, mode, stream);
 }
 
-size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
+__attribute__((used)) size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
 {
   return dll_fread(ptr, size, nmemb, stream);
 }
 
-size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
+__attribute__((used)) size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
 {
   return dll_fwrite(ptr, size, nmemb, stream);
 }
 
-int __wrap_fflush(FILE *stream)
+__attribute__((used)) int __wrap_fflush(FILE *stream)
 {
   return dll_fflush(stream);
 }
 
-int __wrap_fputc(int c, FILE *stream)
+__attribute__((used)) int __wrap_fputc(int c, FILE *stream)
 {
   return dll_fputc(c, stream);
 }
 
-int __wrap_fputs(const char *s, FILE *stream)
+__attribute__((used)) int __wrap_fputs(const char *s, FILE *stream)
 {
   return dll_fputs(s, stream);
 }
 
-int __wrap__IO_putc(int c, FILE *stream)
+__attribute__((used)) int __wrap__IO_putc(int c, FILE *stream)
 {
   return dll_putc(c, stream);
 }
 
-int __wrap_fseek(FILE *stream, long offset, int whence)
+__attribute__((used)) int __wrap_fseek(FILE *stream, long offset, int whence)
 {
   return dll_fseek(stream, offset, whence);
 }
 
-int __wrap_fseeko64(FILE *stream, off64_t offset, int whence)
+__attribute__((used)) int __wrap_fseeko64(FILE *stream, off64_t offset, int whence)
 {
   return dll_fseek64(stream, offset, whence);
 }
 
-long __wrap_ftell(FILE *stream)
+__attribute__((used)) long __wrap_ftell(FILE *stream)
 {
   return dll_ftell(stream);
 }
 
-off64_t __wrap_ftello64(FILE *stream)
+__attribute__((used)) off64_t __wrap_ftello64(FILE *stream)
 {
   return dll_ftell64(stream);
 }
 
-void __wrap_rewind(FILE *stream)
+__attribute__((used)) void __wrap_rewind(FILE *stream)
 {
   dll_rewind(stream);
 }
 
-int __wrap_fgetpos(FILE *stream, fpos_t *pos)
+__attribute__((used)) int __wrap_fgetpos(FILE *stream, fpos_t *pos)
 {
   return dll_fgetpos(stream, pos);
 }
 
-int __wrap_fgetpos64(FILE *stream, fpos64_t *pos)
+__attribute__((used)) int __wrap_fgetpos64(FILE *stream, fpos64_t *pos)
 {
   return dll_fgetpos64(stream, pos);
 }
 
-int __wrap_fsetpos(FILE *stream, fpos_t *pos)
+__attribute__((used)) int __wrap_fsetpos(FILE *stream, fpos_t *pos)
 {
   return dll_fsetpos(stream, pos);
 }
 
-int __wrap_fsetpos64(FILE *stream, fpos64_t *pos)
+__attribute__((used)) int __wrap_fsetpos64(FILE *stream, fpos64_t *pos)
 {
   return dll_fsetpos64(stream, pos);
 }
 
-DIR * __wrap_opendir(const char *name)
+__attribute__((used)) DIR * __wrap_opendir(const char *name)
 {
   return dll_opendir(name);
 }
 
-struct dirent * __wrap_readdir(DIR* dirp)
+__attribute__((used)) struct dirent * __wrap_readdir(DIR* dirp)
 {
   return dll_readdir(dirp);
 }
 
-struct dirent * __wrap_readdir64(DIR* dirp)
+__attribute__((used)) struct dirent * __wrap_readdir64(DIR* dirp)
 {
   return dll_readdir(dirp);
 }
 
-int __wrap_closedir(DIR* dirp)
+__attribute__((used)) int __wrap_closedir(DIR* dirp)
 {
   return dll_closedir(dirp);
 }
 
-void __wrap_rewinddir(DIR* dirp)
+__attribute__((used)) void __wrap_rewinddir(DIR* dirp)
 {
   dll_rewinddir(dirp);
 }
 
-int __wrap_fprintf(FILE *stream, const char *format, ...)
+__attribute__((used)) int __wrap_fprintf(FILE *stream, const char *format, ...)
 {
     int res;
     va_list va;
@@ -340,12 +340,12 @@
     return res;
 }
 
-int __wrap_vfprintf(FILE *stream, const char *format, va_list ap)
+__attribute__((used)) int __wrap_vfprintf(FILE *stream, const char *format, va_list ap)
 {
   return dll_vfprintf(stream, format, ap);
 }
 
-int __wrap_printf(const char *format, ...)
+__attribute__((used)) int __wrap_printf(const char *format, ...)
 {
     int res;
     va_list va;
@@ -355,42 +355,42 @@
     return res;
 }
 
-int __wrap_fgetc(FILE *stream)
+__attribute__((used)) int __wrap_fgetc(FILE *stream)
 {
   return dll_fgetc(stream);
 }
 
-char *__wrap_fgets(char *s, int size, FILE *stream)
+__attribute__((used)) char *__wrap_fgets(char *s, int size, FILE *stream)
 {
   return dll_fgets(s, size, stream);
 }
 
-int __wrap__IO_getc(FILE *stream)
+__attribute__((used)) int __wrap__IO_getc(FILE *stream)
 {
   return dll_getc(stream);
 }
 
-int __wrap__IO_getc_unlocked(FILE *stream)
+__attribute__((used)) int __wrap__IO_getc_unlocked(FILE *stream)
 {
   return dll_getc(stream);
 }
 
-int __wrap_getc_unlocked(FILE *stream)
+__attribute__((used)) int __wrap_getc_unlocked(FILE *stream)
 {
   return dll_getc(stream);
 }
 
-int __wrap_ungetc(int c, FILE *stream)
+__attribute__((used)) int __wrap_ungetc(int c, FILE *stream)
 {
   return dll_ungetc(c, stream);
 }
 
-int __wrap_getc(FILE *stream)
+__attribute__((used)) int __wrap_getc(FILE *stream)
 {
   return dll_getc(stream);
 }
 
-int __wrap_ioctl(int d, unsigned long int request, ...)
+__attribute__((used)) int __wrap_ioctl(int d, unsigned long int request, ...)
 {
     int res;
     va_list va;
@@ -400,57 +400,57 @@
     return res;
 } 
 
-int __wrap__stat(const char *path, struct _stat *buffer)
+__attribute__((used)) int __wrap__stat(const char *path, struct _stat *buffer)
 {
   return dll_stat(path, buffer);
 }
 
-int __wrap_stat(const char *path, struct _stat *buffer)
+__attribute__((used)) int __wrap_stat(const char *path, struct _stat *buffer)
 {
   return dll_stat(path, buffer);
 }
 
-int __wrap___xstat64(int __ver, const char *__filename, struct stat64 *__stat_buf)
+__attribute__((used)) int __wrap___xstat64(int __ver, const char *__filename, struct stat64 *__stat_buf)
 {
   return dll_stat64(__filename, __stat_buf);
 }
 
-int __wrap___lxstat64(int __ver, const char *__filename, struct stat64 *__stat_buf)
+__attribute__((used)) int __wrap___lxstat64(int __ver, const char *__filename, struct stat64 *__stat_buf)
 {
   return dll_stat64(__filename, __stat_buf);
 }
 
-void __wrap_flockfile(FILE *file)
+__attribute__((used)) void __wrap_flockfile(FILE *file)
 {
     dll_flockfile(file);
 }
 
-int __wrap_ftrylockfile(FILE *file)
+__attribute__((used)) int __wrap_ftrylockfile(FILE *file)
 {
     return dll_ftrylockfile(file);
 }
 
-void __wrap_funlockfile(FILE *file)
+__attribute__((used)) void __wrap_funlockfile(FILE *file)
 {
     dll_funlockfile(file);
 }
 
-int __wrap___fxstat64(int ver, int fd, struct stat64 *buf)
+__attribute__((used)) int __wrap___fxstat64(int ver, int fd, struct stat64 *buf)
 {
   return dll_fstat64(fd, buf);
 }
 
-int __wrap_fstat(int fd, struct _stat *buf)
+__attribute__((used)) int __wrap_fstat(int fd, struct _stat *buf)
 {
   return dll_fstat(fd, buf);
 }
 
-int __wrap_setvbuf(FILE *stream, char *buf, int type, size_t size)
+__attribute__((used)) int __wrap_setvbuf(FILE *stream, char *buf, int type, size_t size)
 {
    return dll_setvbuf(stream, buf, type, size);
 }
 
-struct mntent *__wrap_getmntent(FILE *fp)
+__attribute__((used)) struct mntent *__wrap_getmntent(FILE *fp)
 {
 #ifdef _LINUX
   return dll_getmntent(fp);
@@ -464,12 +464,12 @@
 // thing to actually call our wrapped functions. 
 #if _FORTIFY_SOURCE > 1
 
-size_t __wrap___fread_chk(void * ptr, size_t ptrlen, size_t size, size_t n, FILE * stream)
+__attribute__((used)) size_t __wrap___fread_chk(void * ptr, size_t ptrlen, size_t size, size_t n, FILE * stream)
 {
   return dll_fread(ptr, size, n, stream);
 }
 
-int __wrap___printf_chk(int flag, const char *format, ...)
+__attribute__((used)) int __wrap___printf_chk(int flag, const char *format, ...)
 {
   int res;
   va_list va;
@@ -479,12 +479,12 @@
   return res;
 }
 
-int __wrap___vfprintf_chk(FILE* stream, int flag, const char *format, _G_va_list ap)
+__attribute__((used)) int __wrap___vfprintf_chk(FILE* stream, int flag, const char *format, _G_va_list ap)
 {
   return dll_vfprintf(stream, format, ap);
 }
 
-int __wrap___fprintf_chk(FILE * stream, int flag, const char *format, ...)
+__attribute__((used)) int __wrap___fprintf_chk(FILE * stream, int flag, const char *format, ...)
 {
   int res;
   va_list va;
@@ -494,12 +494,12 @@
   return res;
 }
 
-char *__wrap___fgets_chk(char *s, size_t size, int n, FILE *stream)
+__attribute__((used)) char *__wrap___fgets_chk(char *s, size_t size, int n, FILE *stream)
 {
   return dll_fgets(s, n, stream);
 }
 
-size_t __wrap___read_chk(int fd, void *buf, size_t nbytes, size_t buflen)
+__attribute__((used)) size_t __wrap___read_chk(int fd, void *buf, size_t nbytes, size_t buflen)
 {
   return dll_read(fd, buf, nbytes);
 }
