aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-04-28 09:34:02 +0100
committerNick Clifton <nickc@redhat.com>2014-04-28 09:34:02 +0100
commit40af4a3636504a0e7e0223b34ed1e7b15c4fa5da (patch)
tree1cde575c0148c065ef4f0f370e4d2803efcb20c4
parente3e163dbb0c50aa94af5416aca86d9ef9c225205 (diff)
downloadgdb-40af4a3636504a0e7e0223b34ed1e7b15c4fa5da.zip
gdb-40af4a3636504a0e7e0223b34ed1e7b15c4fa5da.tar.gz
gdb-40af4a3636504a0e7e0223b34ed1e7b15c4fa5da.tar.bz2
This patch reworks the fix to avoid a compile time warning so that it will work
with later versions of gcc. PR ld/16821 * peXXigen.c (_bfd_XXi_swap_sym_out): Rework fix to avoid compile time warning.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/peXXigen.c15
2 files changed, 12 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index eb0c704..2a1642d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-28 Nick Clifton <nickc@redhat.com>
+
+ PR ld/16821
+ * peXXigen.c (_bfd_XXi_swap_sym_out): Rework fix to avoid compile
+ time warning.
+
2014-04-26 Alan Modra <amodra@gmail.com>
* po/SRC-POTFILES.in: Regenerate.
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index dc45daf..8f6f0eb 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -236,15 +236,12 @@ _bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp)
reduce the absolute value to < 1^32, and then transforming the
symbol into a section relative symbol. This of course is a hack. */
if (sizeof (in->n_value) > 4
- /* GCC 4.6.x erroneously complains about the next test always being
- false when compiled on a 32-bit host. (The sizeof test above
- should have made the warning unnecessary). Hence we have to
- predicate the test. It should not matter if the test is omitted
- since the worst that can happen is that some absolute symbols
- are needlessly converted to equivalent section relative symbols. */
-#if defined BFD64 || ! defined __GNUC__ || __GNUC__ > 4 || __GNUC_MINOR__ > 6
- && in->n_value > ((1ULL << 32) - 1)
-#endif
+ /* The strange computation of the shift amount is here in order to
+ avoid a compile time warning about the comparison always being
+ false. It does not matter if this test fails to work as expected
+ as the worst that can happen is that some absolute symbols are
+ needlessly converted into section relative symbols. */
+ && in->n_value > ((1ULL << (sizeof (in->n_value) > 4 ? 32 : 31)) - 1)
&& in->n_scnum == -1)
{
asection * sec;