public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] bfd_elf_print_symbol
@ 2007-07-27 20:44 msnyder
  2007-08-01  6:11 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: msnyder @ 2007-07-27 20:44 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

Actually, I've attached two patches -- please tell me which one
you prefer.

The first patch assumes that symbol->section CAN be null
(as implied by the test at line 1350).  In that case it needs
to be checked before invoking bfd_is_com_section, which will
dereference it.

The second patch assumes that symbol->section CANNOT be null,
in which case I am guessing that the test at line 1350 was
intended to be checking symbol->section->name.


[-- Attachment #2: section1.txt --]
[-- Type: text/plain, Size: 1237 bytes --]

2007-07-27  Michael Snyder  <msnyder@access-company.com>

	* elf.c (bfd_elf_print_symbol): Macro dereferences pointer, so
	pointer must be non-null.

Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.401
diff -p -r1.401 elf.c
*** elf.c	26 Jul 2007 18:15:46 -0000	1.401
--- elf.c	27 Jul 2007 20:29:16 -0000
*************** bfd_elf_print_symbol (bfd *abfd,
*** 1364,1370 ****
  	   we've already printed the size; now print the alignment.
  	   For other symbols, we have no specified alignment, and
  	   we've printed the address; now print the size.  */
! 	if (bfd_is_com_section (symbol->section))
  	  val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_value;
  	else
  	  val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_size;
--- 1364,1370 ----
  	   we've already printed the size; now print the alignment.
  	   For other symbols, we have no specified alignment, and
  	   we've printed the address; now print the size.  */
! 	if (symbol->section && bfd_is_com_section (symbol->section))
  	  val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_value;
  	else
  	  val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_size;

[-- Attachment #3: section2.txt --]
[-- Type: text/plain, Size: 846 bytes --]

2007-07-27  Michael Snyder  <msnyder@access-company.com>

	* elf.c (bfd_elf_print_symbol): Fix typo.

Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.401
diff -p -r1.401 elf.c
*** elf.c	26 Jul 2007 18:15:46 -0000	1.401
--- elf.c	27 Jul 2007 20:31:17 -0000
*************** bfd_elf_print_symbol (bfd *abfd,
*** 1347,1353 ****
  	unsigned char st_other;
  	bfd_vma val;
  
! 	section_name = symbol->section ? symbol->section->name : "(*none*)";
  
  	bed = get_elf_backend_data (abfd);
  	if (bed->elf_backend_print_symbol_all)
--- 1347,1354 ----
  	unsigned char st_other;
  	bfd_vma val;
  
! 	section_name = symbol->section->name 
! 	  ? symbol->section->name : "(*none*)";
  
  	bed = get_elf_backend_data (abfd);
  	if (bed->elf_backend_print_symbol_all)

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

* Re: [PATCH] bfd_elf_print_symbol
  2007-07-27 20:44 [PATCH] bfd_elf_print_symbol msnyder
@ 2007-08-01  6:11 ` Alan Modra
  2007-08-01 19:55   ` msnyder
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2007-08-01  6:11 UTC (permalink / raw)
  To: msnyder; +Cc: binutils

On Fri, Jul 27, 2007 at 01:35:10PM -0700, msnyder@sonic.net wrote:
> 	* elf.c (bfd_elf_print_symbol): Macro dereferences pointer, so
> 	pointer must be non-null.

OK.

> 	* elf.c (bfd_elf_print_symbol): Fix typo.

No, this isn't a typo.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH] bfd_elf_print_symbol
  2007-08-01  6:11 ` Alan Modra
@ 2007-08-01 19:55   ` msnyder
  0 siblings, 0 replies; 3+ messages in thread
From: msnyder @ 2007-08-01 19:55 UTC (permalink / raw)
  To: binutils

> On Fri, Jul 27, 2007 at 01:35:10PM -0700, msnyder@sonic.net wrote:
>> 	* elf.c (bfd_elf_print_symbol): Macro dereferences pointer, so
>> 	pointer must be non-null.
>
> OK.

Thanks, committed.


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

end of thread, other threads:[~2007-08-01 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 20:44 [PATCH] bfd_elf_print_symbol msnyder
2007-08-01  6:11 ` Alan Modra
2007-08-01 19:55   ` msnyder

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).