summarylogtreecommitdiffstats
path: root/0001-Revert-elf-Correct-absolute-SHN_ABS-symbol-run-time-.patch
blob: 6134cf3df022251d1ffe0b4e9c5796a5ad1203a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
From 5daaa10c03afc2180b698e0751bbc2b4abc313f0 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@archlinux.org>
Date: Fri, 28 Sep 2018 05:19:46 +0000
Subject: [PATCH] Revert "elf: Correct absolute (SHN_ABS) symbol run-time
 calculation [BZ #19818]"

This reverts commit e7feec374c635b6a29d65c39ae5e1855528fed39.
---
 elf/Makefile                 |  4 ++--
 elf/dl-addr.c                |  2 --
 elf/tst-absolute-sym-lib.c   | 25 ------------------------
 elf/tst-absolute-sym-lib.lds | 19 ------------------
 elf/tst-absolute-sym.c       | 38 ------------------------------------
 sysdeps/generic/ldsodefs.h   |  3 +--
 6 files changed, 3 insertions(+), 88 deletions(-)
 delete mode 100644 elf/tst-absolute-sym-lib.c
 delete mode 100644 elf/tst-absolute-sym-lib.lds
 delete mode 100644 elf/tst-absolute-sym.c

diff --git a/elf/Makefile b/elf/Makefile
index 632a4d8b0f..2a824e3c64 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -197,7 +197,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
 	 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
 	 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
 	 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
-	 tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \
+	 tst-debug1 tst-main1 tst-absolute-zero tst-big-note \
 	 tst-unwind-ctor tst-unwind-main tst-audit13 \
 	 tst-sonamemove-link tst-sonamemove-dlopen tst-dlopen-tlsmodid \
 	 tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
@@ -303,7 +303,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
 		tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
 		tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \
-		tst-main1mod tst-libc_dlvsym-dso tst-absolute-sym-lib \
+		tst-main1mod tst-libc_dlvsym-dso \
 		tst-absolute-zero-lib tst-big-note-lib tst-unwind-ctor-lib \
 		tst-audit13mod1 tst-sonamemove-linkmod1 \
 		tst-sonamemove-runmod1 tst-sonamemove-runmod2 \
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index 693cfd2a62..4458a521f4 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -60,7 +60,6 @@ determine_info (const ElfW(Addr) addr, struct link_map *match, Dl_info *info,
 		  symndx = ELF_MACHINE_HASH_SYMIDX (match, hasharr);
 		  if ((symtab[symndx].st_shndx != SHN_UNDEF
 		       || symtab[symndx].st_value != 0)
-		      && symtab[symndx].st_shndx != SHN_ABS
 		      && ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS
 		      && DL_ADDR_SYM_MATCH (match, &symtab[symndx],
 					    matchsym, addr)
@@ -91,7 +90,6 @@ determine_info (const ElfW(Addr) addr, struct link_map *match, Dl_info *info,
 	    && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
 	    && (symtab->st_shndx != SHN_UNDEF
 		|| symtab->st_value != 0)
-	    && symtab->st_shndx != SHN_ABS
 	    && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr)
 	    && symtab->st_name < strtabsize)
 	  matchsym = (ElfW(Sym) *) symtab;
diff --git a/elf/tst-absolute-sym-lib.c b/elf/tst-absolute-sym-lib.c
deleted file mode 100644
index 65daf73080..0000000000
--- a/elf/tst-absolute-sym-lib.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* BZ #19818 absolute symbol calculation shared module.
-   Copyright (C) 2018-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-extern char absolute;
-
-void *
-get_absolute (void)
-{
-  return &absolute;
-}
diff --git a/elf/tst-absolute-sym-lib.lds b/elf/tst-absolute-sym-lib.lds
deleted file mode 100644
index 7f5f2e4757..0000000000
--- a/elf/tst-absolute-sym-lib.lds
+++ /dev/null
@@ -1,19 +0,0 @@
-/* BZ #19818 absolute symbol calculation linker script.
-   Copyright (C) 2018-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-"absolute" = 0x55aa;
diff --git a/elf/tst-absolute-sym.c b/elf/tst-absolute-sym.c
deleted file mode 100644
index bbabf9cafb..0000000000
--- a/elf/tst-absolute-sym.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* BZ #19818 absolute symbol calculation main executable.
-   Copyright (C) 2018-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <support/check.h>
-#include <support/support.h>
-#include <support/test-driver.h>
-
-void *get_absolute (void);
-
-static int
-do_test (void)
-{
-  void *ref = (void *) 0x55aa;
-  void *ptr;
-
-  ptr = get_absolute ();
-  if (ptr != ref)
-    FAIL_EXIT1 ("Got %p, expected %p\n", ptr, ref);
-
-  return 0;
-}
-
-#include <support/test-driver.c>
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 497938ffa2..6499adbf9d 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -89,8 +89,7 @@ typedef struct link_map *lookup_t;
    if non-NULL.  Don't check for NULL map if MAP_SET is TRUE.  */
 #define SYMBOL_ADDRESS(map, ref, map_set)				\
   ((ref) == NULL ? 0							\
-   : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0			\
-      : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value)
+   : LOOKUP_VALUE_ADDRESS (map, map_set) + (ref)->st_value)
 
 /* On some architectures a pointer to a function is not just a pointer
    to the actual code of the function but rather an architecture
-- 
2.25.0