This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] bfd: Use size_t for length argument totarget_read_memory function passed into bfd_elf_bfd_from_remote_memory


Hi,

The target_read_memory function pointer that
bfd_elf_bfd_from_remote_memory accepts current accepts int for length.
I have attached a patch which changes this argument to size_t. This
change is needed because I'm looking to make analogous changes in gdb to
ensure consistency of storage sizes passed across functions to ensure
that larger values are not truncated.

I could write a wrapper around or cast the function pointer explicitly,
but as Jan Kratochvil suggested, it would be cleaner to just make a
change in bfd since it should be taking size_t values anyway. The
conversation thread is here for reference:

http://sourceware.org/ml/gdb-patches/2012-05/msg00909.html

Attached are two patches, the first being changes to bfd and the second
is the change I need to make in gdb to make it work with the changes in
bfd.

Regards,
Siddhesh

bfd/ChangeLog:

2012-05-28  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
	of target_read_memory as size_t.
	* bfd-in2.h: Regenerate.
	* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
	  argument of target_read_memory as size_t.
	(_bfd_elf32_bfd_from_remote_memory): Likewise.
	(_bfd_elf64_bfd_from_remote_memory): Likewise.
	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
	* enfcode.h (NAME): Likewise.

gdb/ChangeLog:

2012-05-28  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* target.c (target_read_memory): Make LEN argument as size_t.
	* target.h (target_read_memory): Likewise.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]