1 From 2cbf10ae2ea9e378ff91b8f5c4d8cb77ed05378e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Bart=C5=82omiej=20Piotrowski?= <bpiotrowski@archlinux.org>
3 Date: Fri, 10 Aug 2018 14:12:40 +0000
4 Subject: [PATCH] Revert "elf: Correct absolute (SHN_ABS) symbol run-time
5 calculation [BZ #19818]"
7 This reverts commit e7feec374c635b6a29d65c39ae5e1855528fed39.
9 elf/Makefile | 14 ++-----------
11 elf/tst-absolute-sym-lib.c | 25 ------------------------
12 elf/tst-absolute-sym-lib.lds | 19 ------------------
13 elf/tst-absolute-sym.c | 38 ------------------------------------
14 sysdeps/generic/ldsodefs.h | 3 +--
15 6 files changed, 3 insertions(+), 98 deletions(-)
16 delete mode 100644 elf/tst-absolute-sym-lib.c
17 delete mode 100644 elf/tst-absolute-sym-lib.lds
18 delete mode 100644 elf/tst-absolute-sym.c
20 diff --git a/elf/Makefile b/elf/Makefile
21 index cd0771307f..5084ba4f6f 100644
24 @@ -186,7 +186,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
25 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
26 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
27 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
28 - tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note
29 + tst-debug1 tst-main1
31 tests-internal += loadtest unload unload2 circleload1 \
32 neededtest neededtest2 neededtest3 neededtest4 \
33 @@ -272,9 +272,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
34 tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
35 tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
36 tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \
37 - tst-main1mod tst-libc_dlvsym-dso tst-absolute-sym-lib \
38 - tst-absolute-zero-lib tst-big-note-lib
40 + tst-main1mod tst-libc_dlvsym-dso
41 ifeq (yes,$(have-mtls-dialect-gnu2))
42 tests += tst-gnu2-tls1
43 modules-names += tst-gnu2-tls1mod
44 @@ -1465,14 +1463,6 @@ tst-main1-no-pie = yes
45 LDLIBS-tst-main1 = $(libsupport)
46 tst-main1mod.so-no-z-defs = yes
48 -LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds
49 -$(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so)
50 -$(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so
52 -LDLIBS-tst-absolute-zero-lib.so = tst-absolute-zero-lib.lds
53 -$(objpfx)tst-absolute-zero-lib.so: $(LDLIBS-tst-absolute-zero-lib.so)
54 -$(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
56 # Both the main program and the DSO for tst-libc_dlvsym need to link
58 $(objpfx)tst-libc_dlvsym: $(libdl)
59 diff --git a/elf/dl-addr.c b/elf/dl-addr.c
60 index e6c7d02094..2250617a73 100644
63 @@ -59,7 +59,6 @@ determine_info (const ElfW(Addr) addr, struct link_map *match, Dl_info *info,
64 we can omit that test here. */
65 if ((symtab[symndx].st_shndx != SHN_UNDEF
66 || symtab[symndx].st_value != 0)
67 - && symtab[symndx].st_shndx != SHN_ABS
68 && ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS
69 && DL_ADDR_SYM_MATCH (match, &symtab[symndx],
71 @@ -92,7 +91,6 @@ determine_info (const ElfW(Addr) addr, struct link_map *match, Dl_info *info,
72 && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
73 && (symtab->st_shndx != SHN_UNDEF
74 || symtab->st_value != 0)
75 - && symtab->st_shndx != SHN_ABS
76 && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr)
77 && symtab->st_name < strtabsize)
78 matchsym = (ElfW(Sym) *) symtab;
79 diff --git a/elf/tst-absolute-sym-lib.c b/elf/tst-absolute-sym-lib.c
80 deleted file mode 100644
81 index 912cb0048a..0000000000
82 --- a/elf/tst-absolute-sym-lib.c
85 -/* BZ #19818 absolute symbol calculation shared module.
86 - Copyright (C) 2018 Free Software Foundation, Inc.
87 - This file is part of the GNU C Library.
89 - The GNU C Library is free software; you can redistribute it and/or
90 - modify it under the terms of the GNU Lesser General Public
91 - License as published by the Free Software Foundation; either
92 - version 2.1 of the License, or (at your option) any later version.
94 - The GNU C Library is distributed in the hope that it will be useful,
95 - but WITHOUT ANY WARRANTY; without even the implied warranty of
96 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
97 - Lesser General Public License for more details.
99 - You should have received a copy of the GNU Lesser General Public
100 - License along with the GNU C Library; if not, see
101 - <http://www.gnu.org/licenses/>. */
103 -extern char absolute;
110 diff --git a/elf/tst-absolute-sym-lib.lds b/elf/tst-absolute-sym-lib.lds
111 deleted file mode 100644
112 index d4a4128514..0000000000
113 --- a/elf/tst-absolute-sym-lib.lds
116 -/* BZ #19818 absolute symbol calculation linker script.
117 - Copyright (C) 2018 Free Software Foundation, Inc.
118 - This file is part of the GNU C Library.
120 - The GNU C Library is free software; you can redistribute it and/or
121 - modify it under the terms of the GNU Lesser General Public
122 - License as published by the Free Software Foundation; either
123 - version 2.1 of the License, or (at your option) any later version.
125 - The GNU C Library is distributed in the hope that it will be useful,
126 - but WITHOUT ANY WARRANTY; without even the implied warranty of
127 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
128 - Lesser General Public License for more details.
130 - You should have received a copy of the GNU Lesser General Public
131 - License along with the GNU C Library; if not, see
132 - <http://www.gnu.org/licenses/>. */
134 -"absolute" = 0x55aa;
135 diff --git a/elf/tst-absolute-sym.c b/elf/tst-absolute-sym.c
136 deleted file mode 100644
137 index 111491d159..0000000000
138 --- a/elf/tst-absolute-sym.c
141 -/* BZ #19818 absolute symbol calculation main executable.
142 - Copyright (C) 2018 Free Software Foundation, Inc.
143 - This file is part of the GNU C Library.
145 - The GNU C Library is free software; you can redistribute it and/or
146 - modify it under the terms of the GNU Lesser General Public
147 - License as published by the Free Software Foundation; either
148 - version 2.1 of the License, or (at your option) any later version.
150 - The GNU C Library is distributed in the hope that it will be useful,
151 - but WITHOUT ANY WARRANTY; without even the implied warranty of
152 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
153 - Lesser General Public License for more details.
155 - You should have received a copy of the GNU Lesser General Public
156 - License along with the GNU C Library; if not, see
157 - <http://www.gnu.org/licenses/>. */
159 -#include <support/check.h>
160 -#include <support/support.h>
161 -#include <support/test-driver.h>
163 -void *get_absolute (void);
168 - void *ref = (void *) 0x55aa;
171 - ptr = get_absolute ();
173 - FAIL_EXIT1 ("Got %p, expected %p\n", ptr, ref);
178 -#include <support/test-driver.c>
179 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
180 index 95dc87519b..3cac4fa362 100644
181 --- a/sysdeps/generic/ldsodefs.h
182 +++ b/sysdeps/generic/ldsodefs.h
183 @@ -72,8 +72,7 @@ typedef struct link_map *lookup_t;
184 if non-NULL. Don't check for NULL map if MAP_SET is TRUE. */
185 #define SYMBOL_ADDRESS(map, ref, map_set) \
187 - : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \
188 - : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value)
189 + : LOOKUP_VALUE_ADDRESS (map, map_set) + (ref)->st_value)
191 /* On some architectures a pointer to a function is not just a pointer
192 to the actual code of the function but rather an architecture