nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1commit 8564af037f5c4c6d2744a89497691359205b2bbc
2Author: Shea Levy <shea@shealevy.com>
3Date: Mon Mar 19 10:52:40 2018 -0400
4
5 Revert "Allow multiply-defined absolute symbols when they have the same value."
6
7 This reverts commit 5dc824ed42cd173c1525f5abc76f4091f11a4dbc.
8
9diff --git a/gold/ChangeLog-2017 b/gold/ChangeLog-2017
10index b2a47710b5..d7ca1b48c0 100644
11--- a/gold/ChangeLog-2017
12+++ b/gold/ChangeLog-2017
13@@ -114,11 +114,6 @@
14 (localedir): Define as @localedir@.
15 (gnulocaledir, gettextsrcdir): Use @datarootdir@.
16
17-2017-11-28 Cary Coutant <ccoutant@gmail.com>
18-
19- * resolve.cc (Symbol_table::resolve): Allow multiply-defined absolute
20- symbols when they have the same value.
21-
22 2017-11-28 Cary Coutant <ccoutant@gmail.com>
23
24 * object.h (class Sized_relobj_file): Remove discarded_eh_frame_shndx_.
25diff --git a/gold/resolve.cc b/gold/resolve.cc
26index 4a5784cf8b..803576bfed 100644
27--- a/gold/resolve.cc
28+++ b/gold/resolve.cc
29@@ -247,28 +247,18 @@ Symbol_table::resolve(Sized_symbol<size>* to,
30 Object* object, const char* version,
31 bool is_default_version)
32 {
33- bool to_is_ordinary;
34- const unsigned int to_shndx = to->shndx(&to_is_ordinary);
35-
36 // It's possible for a symbol to be defined in an object file
37 // using .symver to give it a version, and for there to also be
38 // a linker script giving that symbol the same version. We
39 // don't want to give a multiple-definition error for this
40 // harmless redefinition.
41+ bool to_is_ordinary;
42 if (to->source() == Symbol::FROM_OBJECT
43 && to->object() == object
44- && to->is_defined()
45 && is_ordinary
46+ && to->is_defined()
47+ && to->shndx(&to_is_ordinary) == st_shndx
48 && to_is_ordinary
49- && to_shndx == st_shndx
50- && to->value() == sym.get_st_value())
51- return;
52-
53- // Likewise for an absolute symbol defined twice with the same value.
54- if (!is_ordinary
55- && st_shndx == elfcpp::SHN_ABS
56- && !to_is_ordinary
57- && to_shndx == elfcpp::SHN_ABS
58 && to->value() == sym.get_st_value())
59 return;
60
61@@ -360,8 +350,8 @@ Symbol_table::resolve(Sized_symbol<size>* to,
62 && (sym.get_st_bind() == elfcpp::STB_WEAK
63 || to->binding() == elfcpp::STB_WEAK)
64 && orig_st_shndx != elfcpp::SHN_UNDEF
65+ && to->shndx(&to_is_ordinary) != elfcpp::SHN_UNDEF
66 && to_is_ordinary
67- && to_shndx != elfcpp::SHN_UNDEF
68 && sym.get_st_size() != 0 // Ignore weird 0-sized symbols.
69 && to->symsize() != 0
70 && (sym.get_st_type() != to->type()
71@@ -372,7 +362,7 @@ Symbol_table::resolve(Sized_symbol<size>* to,
72 {
73 Symbol_location fromloc
74 = { object, orig_st_shndx, static_cast<off_t>(sym.get_st_value()) };
75- Symbol_location toloc = { to->object(), to_shndx,
76+ Symbol_location toloc = { to->object(), to->shndx(&to_is_ordinary),
77 static_cast<off_t>(to->value()) };
78 this->candidate_odr_violations_[to->name()].insert(fromloc);
79 this->candidate_odr_violations_[to->name()].insert(toloc);