7378f26a01eb50fc359bfdf2944daf791e2656a1
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / elfutils / 0007-Allow-disabling-symbol-versioning-at-configure-time.patch
1 From bafacacaf7659a4933604662daba26a480b29a8d Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Thu, 23 Apr 2015 20:46:59 +0200
4 Subject: [PATCH] Allow disabling symbol versioning at configure time
5
6 Due to missing symbol versioning support in uClibc calls to versioned
7 functions that internally call different version of themselves results
8 in infinite recursion.
9
10 Introduce macro SYMBOL_VERSIONING and use it instead of plain SHARED to
11 decide whether symbol versioning is needed. Control this macro
12 definition with new configure option --disable-symbol-versioning.
13
14 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
15 Signed-off-by: Mark Wielaard <mjw@redhat.com>
16 ---
17 Backported from: bafacacaf7659a4933604662daba26a480b29a8d
18 Changes to ChangeLogs are dropped.
19
20  config/eu.am                   | 10 ++++++++--
21  configure.ac                   |  7 +++++++
22  lib/eu-config.h                |  6 +++---
23  libdwfl/core-file.c            |  2 +-
24  libdwfl/dwfl_module_build_id.c |  2 +-
25  libdwfl/dwfl_report_elf.c      |  2 +-
26
27 diff --git a/config/eu.am b/config/eu.am
28 index faf8add..6103a3e 100644
29 --- a/config/eu.am
30 +++ b/config/eu.am
31 @@ -38,16 +38,22 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
32  
33  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
34  
35 +DEFS.os = -DPIC -DSHARED
36 +if SYMBOL_VERSIONING
37 +DEFS.os += -DSYMBOL_VERSIONING
38 +else
39 +endif
40 +
41  %.os: %.c %.o
42  if AMDEP
43 -       if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
44 +       if $(COMPILE.os) -c -o $@ -fpic $(DEFS.os) -MT $@ -MD -MP \
45           -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
46         then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
47              rm -f "$(DEPDIR)/$*.Tpo"; \
48         else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
49         fi
50  else
51 -       $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $<
52 +       $(COMPILE.os) -c -o $@ -fpic $(DEFS.os) $<
53  endif
54  
55  CLEANFILES = *.gcno *.gcda
56 diff --git a/configure.ac b/configure.ac
57 index ed2c964..be01573 100644
58 --- a/configure.ac
59 +++ b/configure.ac
60 @@ -241,6 +241,13 @@ AS_HELP_STRING([--disable-textrelcheck],
61                 [Disable textrelcheck being a fatal error]))
62  AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"])
63  
64 +AC_ARG_ENABLE([symbol-versioning],
65 +AS_HELP_STRING([--disable-symbol-versioning],
66 +               [Disable symbol versioning in shared objects]))
67 +AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"])
68 +AS_IF([test "x$enable_symbol_versioning" = "xno"],
69 +      [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])])
70 +
71  dnl The directories with content.
72  
73  dnl Documentation.
74 diff --git a/lib/eu-config.h b/lib/eu-config.h
75 index 3afff26..5bb21c1 100644
76 --- a/lib/eu-config.h
77 +++ b/lib/eu-config.h
78 @@ -163,7 +163,7 @@ asm (".section predict_data, \"aw\"; .previous\n"
79  #define ELFUTILS_HEADER(name) <lib##name.h>
80  
81  
82 -#ifdef SHARED
83 +#ifdef SYMBOL_VERSIONING
84  # define OLD_VERSION(name, version) \
85    asm (".globl _compat." #version "." #name "\n" \
86         "_compat." #version "." #name " = " #name "\n" \
87 @@ -181,8 +181,8 @@ asm (".section predict_data, \"aw\"; .previous\n"
88  # define OLD_VERSION(name, version) /* Nothing for static linking.  */
89  # define NEW_VERSION(name, version) /* Nothing for static linking.  */
90  # define COMPAT_VERSION_NEWPROTO(name, version, prefix) \
91 -  error "should use #ifdef SHARED"
92 -# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SHARED"
93 +  error "should use #ifdef SYMBOL_VERSIONING"
94 +# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SYMBOL_VERSIONING"
95  #endif
96  
97  
98 diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
99 index 324e9d2..bbe0899 100644
100 --- a/libdwfl/core-file.c
101 +++ b/libdwfl/core-file.c
102 @@ -588,7 +588,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
103  INTDEF (dwfl_core_file_report)
104  NEW_VERSION (dwfl_core_file_report, ELFUTILS_0.158)
105  
106 -#ifdef SHARED
107 +#ifdef SYMBOL_VERSIONING
108  int _compat_without_executable_dwfl_core_file_report (Dwfl *dwfl, Elf *elf);
109  COMPAT_VERSION_NEWPROTO (dwfl_core_file_report, ELFUTILS_0.146,
110                          without_executable)
111 diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c
112 index 350bbf8..c9a42ca 100644
113 --- a/libdwfl/dwfl_module_build_id.c
114 +++ b/libdwfl/dwfl_module_build_id.c
115 @@ -101,7 +101,7 @@ dwfl_module_build_id (Dwfl_Module *mod,
116  INTDEF (dwfl_module_build_id)
117  NEW_VERSION (dwfl_module_build_id, ELFUTILS_0.138)
118  
119 -#ifdef SHARED
120 +#ifdef SYMBOL_VERSIONING
121  COMPAT_VERSION (dwfl_module_build_id, ELFUTILS_0.130, vaddr_at_end)
122  
123  int
124 diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
125 index 3a4ae2e..624284c 100644
126 --- a/libdwfl/dwfl_report_elf.c
127 +++ b/libdwfl/dwfl_report_elf.c
128 @@ -321,7 +321,7 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd,
129  INTDEF (dwfl_report_elf)
130  NEW_VERSION (dwfl_report_elf, ELFUTILS_0.156)
131  
132 -#ifdef SHARED
133 +#ifdef SYMBOL_VERSIONING
134  Dwfl_Module *
135    _compat_without_add_p_vaddr_dwfl_report_elf (Dwfl *dwfl, const char *name,
136                                                const char *file_name, int fd,
137 -- 
138 1.8.1.4
139