Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame^] | 1 | From a1b93c25311834f2f411e9bfe2e616899ba2122d Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 6 Nov 2016 10:23:55 -0800 |
| 4 | Subject: [PATCH 3/3] Fix build breaks due to missing a.out.h |
| 5 | |
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 7 | --- |
| 8 | Upstream-Status: Pending |
| 9 | |
| 10 | include/bsd/nlist.h | 1 - |
| 11 | include/bsd/nlist.h => src/local-aout.h | 47 ++++++++++++++++++++++----------- |
| 12 | src/nlist.c | 9 +++++++ |
| 13 | 3 files changed, 41 insertions(+), 16 deletions(-) |
| 14 | copy include/bsd/nlist.h => src/local-aout.h (63%) |
| 15 | |
| 16 | diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h |
| 17 | index 0389ab7..9c7e3d8 100644 |
| 18 | --- a/include/bsd/nlist.h |
| 19 | +++ b/include/bsd/nlist.h |
| 20 | @@ -28,7 +28,6 @@ |
| 21 | #define LIBBSD_NLIST_H |
| 22 | |
| 23 | #include <sys/cdefs.h> |
| 24 | -#include <a.out.h> |
| 25 | |
| 26 | /* __BEGIN_DECLS */ |
| 27 | #ifdef __cplusplus |
| 28 | diff --git a/include/bsd/nlist.h b/src/local-aout.h |
| 29 | similarity index 63% |
| 30 | copy from include/bsd/nlist.h |
| 31 | copy to src/local-aout.h |
| 32 | index 0389ab7..2adb93e 100644 |
| 33 | --- a/include/bsd/nlist.h |
| 34 | +++ b/src/local-aout.h |
| 35 | @@ -1,5 +1,5 @@ |
| 36 | /* |
| 37 | - * Copyright © 2009 Guillem Jover <guillem@hadrons.org> |
| 38 | + * Copyright © 2016 Khem Raj <raj.khem@gmail.com> |
| 39 | * |
| 40 | * Redistribution and use in source and binary forms, with or without |
| 41 | * modification, are permitted provided that the following conditions |
| 42 | @@ -24,20 +24,37 @@ |
| 43 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 | */ |
| 45 | |
| 46 | -#ifndef LIBBSD_NLIST_H |
| 47 | -#define LIBBSD_NLIST_H |
| 48 | +#ifndef LIBBSD_LOCAL_AOUT_H |
| 49 | +#define LIBBSD_LOCAL_AOUT_H |
| 50 | |
| 51 | -#include <sys/cdefs.h> |
| 52 | -#include <a.out.h> |
| 53 | +#define N_UNDF 0 |
| 54 | +#define N_ABS 2 |
| 55 | +#define N_TEXT 4 |
| 56 | +#define N_DATA 6 |
| 57 | +#define N_BSS 8 |
| 58 | +#define N_FN 15 |
| 59 | +#define N_EXT 1 |
| 60 | +#define N_TYPE 036 |
| 61 | +#define N_STAB 0340 |
| 62 | +#define N_INDR 0xa |
| 63 | +#define N_SETA 0x14 /* Absolute set element symbol. */ |
| 64 | +#define N_SETT 0x16 /* Text set element symbol. */ |
| 65 | +#define N_SETD 0x18 /* Data set element symbol. */ |
| 66 | +#define N_SETB 0x1A /* Bss set element symbol. */ |
| 67 | +#define N_SETV 0x1C /* Pointer to set vector in data area. */ |
| 68 | |
| 69 | -/* __BEGIN_DECLS */ |
| 70 | -#ifdef __cplusplus |
| 71 | -extern "C" { |
| 72 | -#endif |
| 73 | -extern int nlist(const char *filename, struct nlist *list); |
| 74 | -#ifdef __cplusplus |
| 75 | -} |
| 76 | -#endif |
| 77 | -/* __END_DECLS */ |
| 78 | +struct nlist |
| 79 | +{ |
| 80 | + union |
| 81 | + { |
| 82 | + char *n_name; |
| 83 | + struct nlist *n_next; |
| 84 | + long n_strx; |
| 85 | + } n_un; |
| 86 | + unsigned char n_type; |
| 87 | + char n_other; |
| 88 | + short n_desc; |
| 89 | + unsigned long n_value; |
| 90 | +}; |
| 91 | |
| 92 | -#endif |
| 93 | +#endif /* LIBBSD_LOCAL_AOUT_H */ |
| 94 | diff --git a/src/nlist.c b/src/nlist.c |
| 95 | index 0cffe55..625d310 100644 |
| 96 | --- a/src/nlist.c |
| 97 | +++ b/src/nlist.c |
| 98 | @@ -40,7 +40,11 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93"; |
| 99 | |
| 100 | #include <errno.h> |
| 101 | #include <fcntl.h> |
| 102 | +#ifdef __GLIBC__ |
| 103 | #include <a.out.h> |
| 104 | +#else |
| 105 | +#define __NO_A_OUT_SUPPORT |
| 106 | +#endif |
| 107 | #include <stdio.h> |
| 108 | #include <string.h> |
| 109 | #include <unistd.h> |
| 110 | @@ -48,12 +52,17 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93"; |
| 111 | #if !defined(__NO_A_OUT_SUPPORT) |
| 112 | #define _NLIST_DO_AOUT |
| 113 | #endif |
| 114 | + |
| 115 | #define _NLIST_DO_ELF |
| 116 | |
| 117 | #ifdef _NLIST_DO_ELF |
| 118 | #include "local-elf.h" |
| 119 | #endif |
| 120 | |
| 121 | +#ifdef _NLIST_DO_ELF |
| 122 | +#include "local-aout.h" |
| 123 | +#endif |
| 124 | + |
| 125 | #define SIZE_T_MAX 0xffffffffU |
| 126 | |
| 127 | #ifdef _NLIST_DO_AOUT |
| 128 | -- |
| 129 | 2.10.2 |
| 130 | |