bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/25355] nm reports data variable as "T" with -flto


From: hjl.tools at gmail dot com
Subject: [Bug binutils/25355] nm reports data variable as "T" with -flto
Date: Tue, 11 Feb 2020 12:22:04 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25355

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |WAITING

--- Comment #21 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Martin Liška from comment #19)
> Thank you H.J. but I see the following memory corruption with the patch
> applied:
> 
> $ valgrind ~/bin/binutils/bin/nm --plugin
> /usr/bin/../bin/../lib/bfd-plugins/liblto_plugin.so.0.0.0 x.o
> ...
> ==28080== Invalid read of size 8
> ==28080==    at 0x48A55D: bfd_plugin_canonicalize_symtab (plugin.c:860)
> ==28080==    by 0x4123C4: _bfd_generic_read_minisymbols (syms.c:826)
> ==28080==    by 0x4039A9: display_rel_file (nm.c:1112)
> ==28080==    by 0x4043DA: display_file (nm.c:1379)
> ==28080==    by 0x402B64: main (nm.c:1860)
> ==28080==  Address 0x4a81498 is 1,704 bytes inside a block of size 4,064
> free'd
> ==28080==    at 0x48389AB: free (in
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==28080==    by 0x4ACCF2: objalloc_free (objalloc.c:187)
> ==28080==    by 0x40FAB2: _bfd_delete_bfd (opncls.c:126)
> ==28080==    by 0x41067B: bfd_close_all_done (opncls.c:797)
> ==28080==    by 0x41067B: bfd_close_all_done (opncls.c:785)
> ==28080==    by 0x48A236: add_input_file (plugin.c:315)
> ==28080==    by 0x485B1D1: ??? (in
> /usr/lib64/gcc/x86_64-suse-linux/9/liblto_plugin.so.0.0.0)
> ==28080==    by 0x48A8FB: try_claim (plugin.c:417)
> ==28080==    by 0x48A8FB: try_load_plugin (plugin.c:562)
> ==28080==    by 0x48AF4C: load_plugin (plugin.c:637)
> ==28080==    by 0x48AF4C: bfd_plugin_object_p (plugin.c:704)
> ==28080==    by 0x40DE35: bfd_check_format_matches (format.c:261)
> ==28080==    by 0x4043B1: display_file (nm.c:1375)
> ==28080==    by 0x402B64: main (nm.c:1860)
> ==28080==  Block was alloc'd at
> ==28080==    at 0x483777F: malloc (in
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==28080==    by 0x4ACC2B: _objalloc_alloc (objalloc.c:159)
> ==28080==    by 0x410990: bfd_alloc (opncls.c:978)
> ==28080==    by 0x410E29: bfd_zalloc (opncls.c:1027)
> ==28080==    by 0x42C679: _bfd_elf_new_section_hook (elf.c:2902)
> ==28080==    by 0x41148E: bfd_section_init (section.c:825)
> ==28080==    by 0x42B46B: _bfd_elf_make_section_from_shdr (elf.c:1035)
> ==28080==    by 0x42B46B: _bfd_elf_make_section_from_shdr (elf.c:1023)
> ==28080==    by 0x42A9A0: bfd_section_from_shdr (elf.c:2586)
> ==28080==    by 0x4261DB: bfd_elf64_object_p (elfcode.h:815)
> ==28080==    by 0x40DC89: bfd_check_format_matches (format.c:328)
> ==28080==    by 0x48A1E3: add_input_file (plugin.c:300)
> ==28080==    by 0x485B1D1: ??? (in
> /usr/lib64/gcc/x86_64-suse-linux/9/liblto_plugin.so.0.0.0)
> ...

I can't reproduce it on master branch:

[hjl@gnu-cfl-2 pr25355]$ valgrind ./nm --plugin
/usr/bin/../bin/../lib/bfd-plugins/liblto_plugin.so.0.0.0 x.o 
==315887== Memcheck, a memory error detector
==315887== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==315887== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==315887== Command: ./nm --plugin
/usr/bin/../bin/../lib/bfd-plugins/liblto_plugin.so.0.0.0 x.o
==315887== 
         U foo
00000000 T main
00000000 B nm_test_var
00000000 D nm_test_var2
==315887== 
==315887== HEAP SUMMARY:
==315887==     in use at exit: 2,037 bytes in 17 blocks
==315887==   total heap usage: 115 allocs, 98 frees, 169,604 bytes allocated
==315887== 
==315887== LEAK SUMMARY:
==315887==    definitely lost: 83 bytes in 2 blocks
==315887==    indirectly lost: 0 bytes in 0 blocks
==315887==      possibly lost: 0 bytes in 0 blocks
==315887==    still reachable: 1,954 bytes in 15 blocks
==315887==         suppressed: 0 bytes in 0 blocks
==315887== Rerun with --leak-check=full to see details of leaked memory
==315887== 
==315887== For lists of detected and suppressed errors, rerun with: -s
==315887== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[hjl@gnu-cfl-2 pr25355]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]