On Tue, 25 Jan 2011, Alexander Kabaev wrote:

Author: kan
Date: Tue Jan 25 19:17:50 2011
New Revision: 217833
URL: http://svn.freebsd.org/changeset/base/217833

Log:
 Do not allocate buffer to hold data for zero-sized sections.

Thanks.

I understand that this will stop all the WITH_CTF barfing:)

The error also had the side effect that objects ended up way biggre
than they should be; about +50 to +125% depending on what you look at.

..
ERROR: ctfmerge: snd_maestro.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
ERROR: ctfmerge: snd_maestro3.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
ERROR: ctfmerge: snd_neomagic.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
ERROR: ctfmerge: snd_sb16.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
ERROR: ctfmerge: snd_sb8.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
ERROR: ctfmerge: snd_sbc.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
ERROR: ctfmerge: snd_solo.ko.debug: Cannot get sect .note.GNU-stack data: 
Invalid data buffer descriptor
..


Modified:
 head/lib/libelf/elf_data.c

Modified: head/lib/libelf/elf_data.c
==============================================================================
--- head/lib/libelf/elf_data.c  Tue Jan 25 19:05:46 2011        (r217832)
+++ head/lib/libelf/elf_data.c  Tue Jan 25 19:17:50 2011        (r217833)
@@ -115,8 +115,10 @@ elf_getdata(Elf_Scn *s, Elf_Data *d)
        d->d_type    = elftype;
        d->d_version = e->e_version;

-       if (sh_type == SHT_NOBITS)
+       if (sh_type == SHT_NOBITS || sh_size == 0) {
+               STAILQ_INSERT_TAIL(&s->s_data, d, d_next);
                return (d);
+        }

        if ((d->d_buf = malloc(msz*count)) == NULL) {
                (void) _libelf_release_data(d);


--
Bjoern A. Zeeb                                 You have to have visions!
        <ks> Going to jail sucks -- <bz> All my daemons like it!
  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to