b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | --- a/configure.ac |
| 2 | +++ b/configure.ac |
| 3 | @@ -44,6 +44,7 @@ fi |
| 4 | |
| 5 | AC_CONFIG_AUX_DIR([config]) |
| 6 | AC_CONFIG_FILES([config/Makefile]) |
| 7 | +AC_CONFIG_FILES([libgnu/Makefile]) |
| 8 | |
| 9 | AC_COPYRIGHT([Copyright (C) 1996-2024 The elfutils developers.]) |
| 10 | AC_PREREQ(2.63) dnl Minimum Autoconf version required. |
| 11 | @@ -88,11 +89,14 @@ AS_IF([test "$use_locks" = yes], |
| 12 | |
| 13 | AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.]) |
| 14 | |
| 15 | +AC_USE_SYSTEM_EXTENSIONS() |
| 16 | + |
| 17 | m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99]) |
| 18 | AC_PROG_CXX |
| 19 | AC_PROG_RANLIB |
| 20 | AC_PROG_YACC |
| 21 | AC_PROG_LEX([noyywrap]) |
| 22 | +gl_EARLY |
| 23 | # Only available since automake 1.12 |
| 24 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
| 25 | AC_CHECK_TOOL([READELF], [readelf]) |
| 26 | @@ -635,6 +639,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], |
| 27 | CFLAGS="$old_CFLAGS"]) |
| 28 | AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig") |
| 29 | |
| 30 | +gl_INIT |
| 31 | + |
| 32 | saved_LIBS="$LIBS" |
| 33 | AC_SEARCH_LIBS([argp_parse], [argp]) |
| 34 | LIBS="$saved_LIBS" |
| 35 | --- a/lib/eu-config.h |
| 36 | +++ b/lib/eu-config.h |
| 37 | @@ -59,14 +59,19 @@ |
| 38 | # define once(once_control, init_routine) init_routine() |
| 39 | #endif /* USE_LOCKS */ |
| 40 | |
| 41 | -#include <libintl.h> |
| 42 | +#include <gettext.h> |
| 43 | /* gettext helper macros. */ |
| 44 | #define N_(Str) Str |
| 45 | #define _(Str) dgettext ("elfutils", Str) |
| 46 | |
| 47 | /* Compiler-specific definitions. */ |
| 48 | +#define __PRAGMA(str) _Pragma (#str) |
| 49 | +#ifdef __APPLE__ |
| 50 | +#define strong_alias(name, aliasname) __PRAGMA(weak aliasname = name) |
| 51 | +#else |
| 52 | #define strong_alias(name, aliasname) \ |
| 53 | extern __typeof (name) aliasname __attribute__ ((alias (#name))); |
| 54 | +#endif |
| 55 | |
| 56 | #ifdef __i386__ |
| 57 | # define internal_function __attribute__ ((regparm (3), stdcall)) |
| 58 | @@ -77,7 +82,7 @@ |
| 59 | #define internal_strong_alias(name, aliasname) \ |
| 60 | extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function; |
| 61 | |
| 62 | -#ifdef HAVE_VISIBILITY |
| 63 | +#if defined(HAVE_VISIBILITY) && !defined(__APPLE__) |
| 64 | #define attribute_hidden \ |
| 65 | __attribute__ ((visibility ("hidden"))) |
| 66 | #else |
| 67 | @@ -166,7 +171,7 @@ asm (".section predict_data, \"aw\"; .pr |
| 68 | #endif |
| 69 | |
| 70 | /* Avoid PLT entries. */ |
| 71 | -#ifdef PIC |
| 72 | +#if defined(PIC) && !defined(__APPLE__) |
| 73 | # define INTUSE(name) _INTUSE(name) |
| 74 | # define _INTUSE(name) __##name##_internal |
| 75 | # define INTDEF(name) _INTDEF(name) |
| 76 | --- a/backends/i386_auxv.c |
| 77 | +++ b/backends/i386_auxv.c |
| 78 | @@ -48,5 +48,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c |
| 79 | return 1; |
| 80 | } |
| 81 | |
| 82 | -__typeof (i386_auxv_info) x86_64_auxv_info |
| 83 | - __attribute__ ((alias ("i386_auxv_info"))); |
| 84 | +auxv_info_alias(x86_64) |
| 85 | --- a/backends/ppc_regs.c |
| 86 | +++ b/backends/ppc_regs.c |
| 87 | @@ -204,5 +204,11 @@ ppc_register_info (Ebl *ebl __attribute_ |
| 88 | return namelen; |
| 89 | } |
| 90 | |
| 91 | -__typeof (ppc_register_info) |
| 92 | - ppc64_register_info __attribute__ ((alias ("ppc_register_info"))); |
| 93 | +ssize_t |
| 94 | +ppc64_register_info (Ebl *ebl, |
| 95 | + int regno, char *name, size_t namelen, |
| 96 | + const char **prefix, const char **setname, |
| 97 | + int *bits, int *type) |
| 98 | +{ |
| 99 | + return ppc_register_info(ebl, regno, name, namelen, prefix, setname, bits, type); |
| 100 | +} |
| 101 | --- a/backends/libebl_CPU.h |
| 102 | +++ b/backends/libebl_CPU.h |
| 103 | @@ -97,4 +97,10 @@ dwarf_is_pointer (int tag) |
| 104 | case DW_TAG_reference_type: \ |
| 105 | case DW_TAG_rvalue_reference_type |
| 106 | |
| 107 | +#define auxv_info_alias(arch) \ |
| 108 | + int EBLHOOK_1(arch ## _, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \ |
| 109 | + { \ |
| 110 | + return EBLHOOK(auxv_info)(a_type, name, format); \ |
| 111 | + } |
| 112 | + |
| 113 | #endif /* libebl_CPU.h */ |
| 114 | --- a/backends/ppc_auxv.c |
| 115 | +++ b/backends/ppc_auxv.c |
| 116 | @@ -51,5 +51,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c |
| 117 | return 1; |
| 118 | } |
| 119 | |
| 120 | -__typeof (ppc_auxv_info) ppc64_auxv_info |
| 121 | - __attribute__ ((alias ("ppc_auxv_info"))); |
| 122 | +auxv_info_alias(ppc64) |
| 123 | --- a/backends/ppc_cfi.c |
| 124 | +++ b/backends/ppc_cfi.c |
| 125 | @@ -72,6 +72,7 @@ ppc_abi_cfi (Ebl *ebl __attribute__ ((un |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | -__typeof (ppc_abi_cfi) |
| 130 | - ppc64_abi_cfi |
| 131 | - __attribute__ ((alias ("ppc_abi_cfi"))); |
| 132 | +int ppc64_abi_cfi(Ebl *ebl, Dwarf_CIE *abi_info) |
| 133 | +{ |
| 134 | + return ppc_abi_cfi(ebl, abi_info); |
| 135 | +} |
| 136 | --- a/backends/ppc_initreg.c |
| 137 | +++ b/backends/ppc_initreg.c |
| 138 | @@ -68,9 +68,10 @@ ppc_dwarf_to_regno (Ebl *ebl __attribute |
| 139 | abort (); |
| 140 | } |
| 141 | |
| 142 | -__typeof (ppc_dwarf_to_regno) |
| 143 | - ppc64_dwarf_to_regno |
| 144 | - __attribute__ ((alias ("ppc_dwarf_to_regno"))); |
| 145 | +bool ppc64_dwarf_to_regno (Ebl *ebl, unsigned *regno) |
| 146 | +{ |
| 147 | + return ppc_dwarf_to_regno(ebl, regno); |
| 148 | +} |
| 149 | |
| 150 | bool |
| 151 | ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), |
| 152 | @@ -127,6 +128,7 @@ ppc_set_initial_registers_tid (pid_t tid |
| 153 | #endif /* __powerpc__ */ |
| 154 | } |
| 155 | |
| 156 | -__typeof (ppc_set_initial_registers_tid) |
| 157 | - ppc64_set_initial_registers_tid |
| 158 | - __attribute__ ((alias ("ppc_set_initial_registers_tid"))); |
| 159 | +bool ppc64_set_initial_registers_tid(pid_t tid, ebl_tid_registers_t *setfunc, void *arg) |
| 160 | +{ |
| 161 | + return ppc_set_initial_registers_tid(tid, setfunc, arg); |
| 162 | +} |
| 163 | --- a/backends/ppc_attrs.c |
| 164 | +++ b/backends/ppc_attrs.c |
| 165 | @@ -81,6 +81,9 @@ ppc_check_object_attribute (Ebl *ebl __a |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | -__typeof (ppc_check_object_attribute) |
| 170 | - ppc64_check_object_attribute |
| 171 | - __attribute__ ((alias ("ppc_check_object_attribute"))); |
| 172 | +bool ppc64_check_object_attribute(Ebl *ebl, |
| 173 | + const char *vendor, int tag, uint64_t value, |
| 174 | + const char **tag_name, const char **value_name) |
| 175 | +{ |
| 176 | + return ppc_check_object_attribute(ebl, vendor, tag, value, tag_name, value_name); |
| 177 | +} |
| 178 | --- a/libdwfl/libdwflP.h |
| 179 | +++ b/libdwfl/libdwflP.h |
| 180 | @@ -31,6 +31,7 @@ |
| 181 | |
| 182 | #include <libdwfl.h> |
| 183 | #include <libebl.h> |
| 184 | +#include <libeu.h> |
| 185 | #include <assert.h> |
| 186 | #include <dirent.h> |
| 187 | #include <errno.h> |
| 188 | --- /dev/null |
| 189 | +++ b/lib/stdio_ext.h |
| 190 | @@ -0,0 +1,6 @@ |
| 191 | +#include <stdio.h> |
| 192 | +#ifndef __APPLE__ |
| 193 | +#include_next <stdio_ext.h> |
| 194 | +#else |
| 195 | +#define __fsetlocking(...) 0 |
| 196 | +#endif |
| 197 | --- a/libdw/libdwP.h |
| 198 | +++ b/libdw/libdwP.h |
| 199 | @@ -32,6 +32,7 @@ |
| 200 | #include <stdbool.h> |
| 201 | #include <pthread.h> |
| 202 | |
| 203 | +#include <libeu.h> |
| 204 | #include <libdw.h> |
| 205 | #include <dwarf.h> |
| 206 | |
| 207 | --- a/config/libdebuginfod.pc.in |
| 208 | +++ b/config/libdebuginfod.pc.in |
| 209 | @@ -8,5 +8,5 @@ Description: elfutils library to query d |
| 210 | Version: @VERSION@ |
| 211 | URL: http://elfutils.org/ |
| 212 | |
| 213 | -Libs: -L${libdir} -ldebuginfod |
| 214 | +Libs: -L${libdir} -ldebuginfod -lpthread |
| 215 | Cflags: -I${includedir} |
| 216 | --- a/config/libdw.pc.in |
| 217 | +++ b/config/libdw.pc.in |
| 218 | @@ -8,7 +8,7 @@ Description: elfutils library for DWARF |
| 219 | Version: @VERSION@ |
| 220 | URL: http://elfutils.org/ |
| 221 | |
| 222 | -Libs: -L${libdir} -ldw |
| 223 | +Libs: -L${libdir} -ldw -lz -lelf -lz -ldl -lpthread |
| 224 | Cflags: -I${includedir} |
| 225 | |
| 226 | # We need the exact matching elfutils libelf version since internal data |
| 227 | --- a/config/libelf.pc.in |
| 228 | +++ b/config/libelf.pc.in |
| 229 | @@ -8,7 +8,7 @@ Description: elfutils libelf library to |
| 230 | Version: @VERSION@ |
| 231 | URL: http://elfutils.org/ |
| 232 | |
| 233 | -Libs: -L${libdir} -lelf |
| 234 | +Libs: -L${libdir} -lelf -lz |
| 235 | Cflags: -I${includedir} |
| 236 | |
| 237 | Requires.private: zlib @LIBZSTD@ |
| 238 | --- a/lib/next_prime.c |
| 239 | +++ b/lib/next_prime.c |
| 240 | @@ -27,6 +27,7 @@ |
| 241 | the GNU Lesser General Public License along with this program. If |
| 242 | not, see <http://www.gnu.org/licenses/>. */ |
| 243 | |
| 244 | +#include <config.h> |
| 245 | #include <stddef.h> |
| 246 | |
| 247 | |
| 248 | --- a/libebl/eblopenbackend.c |
| 249 | +++ b/libebl/eblopenbackend.c |
| 250 | @@ -200,8 +200,6 @@ static bool default_object_note (const c |
| 251 | uint32_t descsz, const char *desc); |
| 252 | static bool default_debugscn_p (const char *name); |
| 253 | static bool default_copy_reloc_p (int reloc); |
| 254 | -static bool default_none_reloc_p (int reloc); |
| 255 | -static bool default_relative_reloc_p (int reloc); |
| 256 | static bool default_check_special_symbol (Elf *elf, |
| 257 | const GElf_Sym *sym, |
| 258 | const char *name, |
| 259 | @@ -253,8 +251,8 @@ fill_defaults (Ebl *result) |
| 260 | result->object_note = default_object_note; |
| 261 | result->debugscn_p = default_debugscn_p; |
| 262 | result->copy_reloc_p = default_copy_reloc_p; |
| 263 | - result->none_reloc_p = default_none_reloc_p; |
| 264 | - result->relative_reloc_p = default_relative_reloc_p; |
| 265 | + result->none_reloc_p = default_copy_reloc_p; |
| 266 | + result->relative_reloc_p = default_copy_reloc_p; |
| 267 | result->check_special_symbol = default_check_special_symbol; |
| 268 | result->data_marker_symbol = default_data_marker_symbol; |
| 269 | result->check_st_other_bits = default_check_st_other_bits; |
| 270 | @@ -636,8 +634,6 @@ default_copy_reloc_p (int reloc __attrib |
| 271 | { |
| 272 | return false; |
| 273 | } |
| 274 | -strong_alias (default_copy_reloc_p, default_none_reloc_p) |
| 275 | -strong_alias (default_copy_reloc_p, default_relative_reloc_p) |
| 276 | |
| 277 | static bool |
| 278 | default_check_special_symbol (Elf *elf __attribute__ ((unused)), |
| 279 | --- a/src/srcfiles.cxx |
| 280 | +++ b/src/srcfiles.cxx |
| 281 | @@ -78,7 +78,9 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = print_ve |
| 282 | /* Bug report address. */ |
| 283 | ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; |
| 284 | |
| 285 | +#ifdef HAVE_LIBARCHIVE |
| 286 | constexpr size_t BUFFER_SIZE = 8192; |
| 287 | +#endif |
| 288 | |
| 289 | /* Definitions of arguments for argp functions. */ |
| 290 | static const struct argp_option options[] = |
| 291 | --- a/src/Makefile.am |
| 292 | +++ b/src/Makefile.am |
| 293 | @@ -92,6 +92,7 @@ strings_LDADD = $(libelf) $(libeu) $(arg |
| 294 | ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) |
| 295 | unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) |
| 296 | stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib) |
| 297 | +EXTRA_stack_DEPENDENCIES = $(if $(findstring srcfiles,$(bin_PROGRAMS)),$(srcfiles_OBJECTS)) |
| 298 | elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) |
| 299 | elfclassify_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD) |
| 300 | srcfiles_SOURCES = srcfiles.cxx |