This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: More i386 architectures?
> Here is a first pass at implementing an architecture note for x86, and
> a bug-fix for obj-elf.c I noticed.
This ...
> i_note.descsz = 0; /* no description */
> i_note.type = NT_VERSION;
> p = frag_more (sizeof (e_note.namesz));
> - md_number_to_chars (p, (valueT) i_note.namesz, 4);
> + md_number_to_chars (p, (valueT) i_note.namesz, sizeof (e_note.namesz));
> p = frag_more (sizeof (e_note.descsz));
> - md_number_to_chars (p, (valueT) i_note.descsz, 4);
> + md_number_to_chars (p, (valueT) i_note.descsz, sizeof (e_note.descsz));
> p = frag_more (sizeof (e_note.type));
> - md_number_to_chars (p, (valueT) i_note.type, 4);
> + md_number_to_chars (p, (valueT) i_note.type, sizeof (e_note.type));
> + p = frag_more (len + 1);
> + strcpy (p, name);
>
> - for (i = 0; i < len; i++)
> - {
> - ch = *(name + i);
> - {
> - FRAG_APPEND_1_CHAR (ch);
> - }
> - }
> frag_align (2, 0, 0);
>
> subseg_set (seg, subseg);
>
Careful.
My ELF book says that namesz is 4 bytes. I'd assume that the original
author wrote ``...namesz, 4)'' so that it explicitly matched the spec
and not a host dependant sizeof(unsigned long).
Andrew