diff options
| author | Richard Lowe <richlowe@richlowe.net> | 2013-12-09 21:49:37 +0000 |
|---|---|---|
| committer | Richard Lowe <richlowe@richlowe.net> | 2014-01-13 13:09:57 -0500 |
| commit | deec6be0d2203ed491be67ac7ebf52f91a24b83d (patch) | |
| tree | a775a782efe0df160ace0d8cb419dc91af95b4e8 /usr/src | |
| parent | ee169c7e77bc5d28a401dde8533cbd38afd24ae1 (diff) | |
| download | illumos-joyent-deec6be0d2203ed491be67ac7ebf52f91a24b83d.tar.gz | |
4383 libelf can't write extended sections when ELF_F_LAYOUT
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/sgs/libelf/common/update.c | 27 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/packages/common/SUNWonld-README | 1 |
2 files changed, 19 insertions, 9 deletions
diff --git a/usr/src/cmd/sgs/libelf/common/update.c b/usr/src/cmd/sgs/libelf/common/update.c index 0791e09a7e..98bdafb655 100644 --- a/usr/src/cmd/sgs/libelf/common/update.c +++ b/usr/src/cmd/sgs/libelf/common/update.c @@ -347,7 +347,7 @@ _elf_upd_usr(Elf * elf) Ehdr * eh = elf->ed_ehdr; unsigned ver = eh->e_version; register char *p = (char *)eh->e_ident; - + size_t scncnt; /* * Ehdr and Phdr table go first @@ -384,11 +384,11 @@ _elf_upd_usr(Elf * elf) * Allow null buffers for NOBITS. */ - if ((s = elf->ed_hdscn) == 0) + if ((s = elf->ed_hdscn) == 0) { eh->e_shnum = 0; - else { - eh->e_shnum = 1; - *(Shdr*)s->s_shdr = _elf_snode_init.sb_shdr; + scncnt = 0; + } else { + scncnt = 1; s = s->s_next; } for (; s != 0; s = s->s_next) { @@ -399,7 +399,7 @@ _elf_upd_usr(Elf * elf) if ((s->s_myflags & SF_READY) == 0) (void) _elfxx_cookscn(s); - ++eh->e_shnum; + ++scncnt; sz = 0; for (d = s->s_hdnode; d != 0; d = d->db_next) { if ((fsz = elf_fsize(d->db_data.d_type, 1, @@ -425,13 +425,22 @@ _elf_upd_usr(Elf * elf) /* * Shdr table last. Comment above for phnum/phoff applies here. */ - if (eh->e_shnum != 0) + if (scncnt != 0) { /* LINTED */ eh->e_shentsize = (Half)elf_fsize(ELF_T_SHDR, 1, ver); - else + if (scncnt < SHN_LORESERVE) { + eh->e_shnum = scncnt; + } else { + Shdr *sh; + sh = (Shdr *)elf->ed_hdscn->s_shdr; + sh->sh_size = scncnt; + eh->e_shnum = 0; + } + } else { eh->e_shentsize = 0; + } - if ((sz = eh->e_shoff + eh->e_shentsize * eh->e_shnum) > hi) + if ((sz = eh->e_shoff + eh->e_shentsize * scncnt) > hi) hi = sz; #ifdef TEST_SIZE diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 4ef9326cc8..dedd0ea913 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1652,3 +1652,4 @@ Bugid Risk Synopsis 4003 dldump() can't deal with extended sections 4227 ld --library-path is translated to -l-path, not -L 4270 ld(1) argument error reporting is still pretty bad +4383 libelf can't write extended sections when ELF_F_LAYOUT |
