Bug 110995 - [loader] [patch] loader wastes space worth symtab size in load_elf_obj.c
Summary: [loader] [patch] loader wastes space worth symtab size in load_elf_obj.c
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-29 04:20 UTC by Neel Natu
Modified: 2021-10-08 01:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neel Natu 2007-03-29 04:20:02 UTC
When loader loads relocatable object in load_elf_obj.c it wastes space worth
symbol table section size.

The diff below fixes it:

==== //depot/prod/freebsd/Rtricky_freebsd6.0/usr/src/sys/boot/common/load_elf_obj.c#1 - /u/neelnatu/p4/tricky/freebsd/usr/src/sys/boot/common/load_elf_obj.c ====
241,242d240
<                       shdr[i].sh_addr = (Elf_Addr)lastaddr;
<                       lastaddr += shdr[i].sh_size;
Comment 1 K. Macy freebsd_committer freebsd_triage 2007-11-16 06:41:30 UTC
Responsible Changed
From-To: freebsd-bugs->kmacy


I know that the fix is valid. Just need feedback from peter or jhb.
Comment 2 Gavin Atkinson freebsd_committer freebsd_triage 2011-06-01 21:32:28 UTC
Responsible Changed
From-To: kmacy->freebsd-bugs

kmacy has asked for all of his PRs to be reassigned, put back into the 
pool.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:45 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Warner Losh freebsd_committer freebsd_triage 2021-07-04 16:43:27 UTC
After some study, I think this fix looks good to my eye. I've created review https://reviews.freebsd.org/D31017 for it.
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-07-12 21:31:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=297e9f364b5aa243572ee52b1faef9b3542c1c9e

commit 297e9f364b5aa243572ee52b1faef9b3542c1c9e
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-07-12 21:17:05 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-07-12 21:30:27 +0000

    loader: Don't reserve space for symbols twice.

    The current code bumps lastaddr twice for the symbol table
    location. However, the first bump is bogus and results in wasted
    space. Remove it.

    PR:                     110995
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D31017

 stand/common/load_elf_obj.c | 2 --
 1 file changed, 2 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-07-16 18:31:04 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1e1d3725569fac88a9baeac88af8da82d00779d1

commit 1e1d3725569fac88a9baeac88af8da82d00779d1
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-07-12 21:17:05 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-07-16 18:28:45 +0000

    loader: Don't reserve space for symbols twice.

    The current code bumps lastaddr twice for the symbol table
    location. However, the first bump is bogus and results in wasted
    space. Remove it.

    PR:                     110995
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D31017

    (cherry picked from commit 297e9f364b5aa243572ee52b1faef9b3542c1c9e)

 stand/common/load_elf_obj.c | 2 --
 1 file changed, 2 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-10-08 01:17:54 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0ad2e9eac9c318d9e2422750646d668a0b8fef07

commit 0ad2e9eac9c318d9e2422750646d668a0b8fef07
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-07-12 21:17:05 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:16:00 +0000

    loader: Don't reserve space for symbols twice.

    The current code bumps lastaddr twice for the symbol table
    location. However, the first bump is bogus and results in wasted
    space. Remove it.

    PR:                     110995

    (cherry picked from commit 297e9f364b5aa243572ee52b1faef9b3542c1c9e)

 stand/common/load_elf_obj.c | 2 --
 1 file changed, 2 deletions(-)