public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Fix read_ranges for 32-bit long
@ 2023-11-16 23:35 Joseph Myers
  2023-11-17  9:12 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2023-11-16 23:35 UTC (permalink / raw)
  To: binutils

bfd/dwarf2.c:read_ranges compares bfd_vma values against -1UL, which
doesn't work correctly when long is 32-bit and bfd_vma is 64-bit
(observed as "nm -l" being very slow for mingw64 host; probably causes
issues on 32-bit hosts as well as IL32LLP64 cases such as mingw64).
Fix by using (bfd_vma) -1 in place of -1UL, as done elsewhere.

---

OK to commit?

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index b135ef09120..22e6b467598 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3688,7 +3688,7 @@ read_ranges (struct comp_unit *unit, struct arange *arange,
 
       if (low_pc == 0 && high_pc == 0)
 	break;
-      if (low_pc == -1UL && high_pc != -1UL)
+      if (low_pc == (bfd_vma) -1 && high_pc != (bfd_vma) -1)
 	base_address = high_pc;
       else
 	{

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix read_ranges for 32-bit long
  2023-11-16 23:35 Fix read_ranges for 32-bit long Joseph Myers
@ 2023-11-17  9:12 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2023-11-17  9:12 UTC (permalink / raw)
  To: Joseph Myers; +Cc: binutils

On 17.11.2023 00:35, Joseph Myers wrote:
> bfd/dwarf2.c:read_ranges compares bfd_vma values against -1UL, which
> doesn't work correctly when long is 32-bit and bfd_vma is 64-bit
> (observed as "nm -l" being very slow for mingw64 host; probably causes
> issues on 32-bit hosts as well as IL32LLP64 cases such as mingw64).
> Fix by using (bfd_vma) -1 in place of -1UL, as done elsewhere.
> 
> ---
> 
> OK to commit?

Yes. And thanks.

Jan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-17  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16 23:35 Fix read_ranges for 32-bit long Joseph Myers
2023-11-17  9:12 ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).