This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: strip vs elf section groups
- From: Roland McGrath <roland at hack dot frob dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 18 May 2011 09:44:56 -0700
- Subject: Re: strip vs elf section groups
> There is still an issue with unstrip which depends on comparing section
> names for unallocated sections. New binutils gas names all group
> sections ".group" and unstrip would need to compare the signature symbol
> names in case of a SHT_GROUP section. I have not fixed that yet.
unstrip on ET_REL files is really only intended to work for the limited
case of .ko-style files, so this may not really be a practical problem.
unstrip always has to be a bit fuzzy (hence the by-name matching), so I'm
not sure it can really solve this problem.
> + /* If a group section is marked as being removed make
> + sure all the sections it contains are being remove, too. */
Typo: ^d
> + if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
> + {
> + Elf32_Word *grpref;
> + grpref = (Elf32_Word *) shdr_info[cnt].data->d_buf;
This is a getdata buffer, right? i.e. it's been byte-swapped if needed.
> + for (size_t in = 1;
> + in < shdr_info[cnt].data->d_size / sizeof (Elf32_Word);
> + ++in)
> + if (shdr_info[grpref[in]].idx != 0)
At least for the robustify branch (and IMHO might as well do it in trunk)
this should check for a bogon in GRPREF rather than using a wild index.
> @@ -883,6 +899,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
> bool discard_section = (shdr_info[cnt].idx > 0
> && shdr_info[cnt].debug_data == NULL
> && shdr_info[cnt].shdr.sh_type != SHT_NOTE
> + && shdr_info[cnt].shdr.sh_type != SHT_GROUP
> && cnt != ehdr->e_shstrndx);
I'm not clear on all the control logic without reading through it all again.
But does this prevent it ever removing SHT_GROUP sections? They ought to
be removed iff all their constituents were removed.
Thanks,
Roland