From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Subject: Re: RFC: Remove empty output sections
Date: Tue, 15 Mar 2005 19:58:00 -0000 [thread overview]
Message-ID: <20050315195824.GA25667@lucon.org> (raw)
In-Reply-To: <20050314221544.GD1224@bubble.modra.org>
On Tue, Mar 15, 2005 at 08:45:44AM +1030, Alan Modra wrote:
> On Mon, Mar 14, 2005 at 08:10:48AM -0800, H. J. Lu wrote:
> > On Mon, Mar 14, 2005 at 07:05:15PM +1030, Alan Modra wrote:
> > > On Sun, Mar 13, 2005 at 10:31:41PM -0800, H. J. Lu wrote:
> > > > @@ -4883,7 +4893,7 @@ lang_process (void)
> > > > lang_check_section_addresses ();
> > > >
> > > > /* Final stuffs. */
> > > > -
> > > > + lang_mark_used_section ();
> > > > ldemul_finish ();
> > > > lang_finish ();
> > > > }
> > >
> > > Isn't this too late to strip sections? What happens if one of the
> > > sections stripped has a dynamic section symbol?
> >
> > An empty section has a dynamic section symbol. Do you have a testcase
> > for that?
>
> Easy. This also demonstrates another potential problem with removing
> empty sections; Their alignment can affect layout of other sections.
>
Here is the output from readelf -Sls after removing empty sections.
Removing an empty section will certainly change the layout of other
sections. I don't think it should be a problem. I believe that
anything depending on alignment of an empty section is broken.
3 local entries in .dynsym have UND index since they are removed. It
is hard to remove them since it is done too late. I don't think it
should cause any probleme though.
H.J.
-----
There are 11 section headers, starting at offset 0x2164:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 001000 000001 00 AX 0 0 4
[ 2] .dynsym DYNSYM 00001000 002000 000070 10 A 3 4 4
[ 3] .dynstr STRTAB 00001070 002070 00000a 00 A 0 0 1
[ 4] .hash HASH 0000107c 00207c 000030 04 A 2 0 4
[ 5] .data PROGBITS 000010ac 0020ac 000004 00 WA 0 0 4
[ 6] .dynamic DYNAMIC 000010b0 0020b0 000058 08 WA 3 0 4
[ 7] .got.plt PROGBITS 00001108 002108 00000c 04 WA 0 0 4
[ 8] .shstrtab STRTAB 00000000 002114 00004f 00 0 0 1
[ 9] .symtab SYMTAB 00000000 00231c 0000d0 10 10 12 4
[10] .strtab STRTAB 00000000 0023ec 000020 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Elf file type is DYN (Shared object file)
Entry point 0x0
There are 2 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0x00000000 0x00000000 0x01114 0x01114 RWE 0x1000
DYNAMIC 0x0020b0 0x000010b0 0x000010b0 0x00058 0x00058 RW 0x4
Section to Segment mapping:
Segment Sections...
00 .text .dynsym .dynstr .hash .data .dynamic .got.plt
01 .dynamic
Symbol table '.dynsym' contains 7 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 SECTION LOCAL DEFAULT 1
2: 00000000 0 NOTYPE LOCAL DEFAULT UND
3: 000010ac 0 SECTION LOCAL DEFAULT 5
4: 00000000 0 NOTYPE LOCAL DEFAULT UND
5: 00000000 0 NOTYPE LOCAL DEFAULT UND
6: 000010b0 0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
Symbol table '.symtab' contains 13 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 SECTION LOCAL DEFAULT 1
2: 00001000 0 SECTION LOCAL DEFAULT 2
3: 00001070 0 SECTION LOCAL DEFAULT 3
4: 0000107c 0 SECTION LOCAL DEFAULT 4
5: 000010ac 0 SECTION LOCAL DEFAULT 5
6: 000010b0 0 SECTION LOCAL DEFAULT 6
7: 00001108 0 SECTION LOCAL DEFAULT 7
8: 00000000 0 SECTION LOCAL DEFAULT 8
9: 00000000 0 SECTION LOCAL DEFAULT 9
10: 00000000 0 SECTION LOCAL DEFAULT 10
11: 00001108 0 OBJECT LOCAL HIDDEN ABS _GLOBAL_OFFSET_TABLE_
12: 000010b0 0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
next prev parent reply other threads:[~2005-03-15 19:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-24 22:38 H. J. Lu
2005-02-25 15:30 ` H. J. Lu
2005-03-01 11:46 ` Nick Clifton
2005-03-14 6:32 ` H. J. Lu
2005-03-14 8:35 ` Alan Modra
2005-03-14 16:11 ` H. J. Lu
2005-03-14 22:15 ` Alan Modra
2005-03-15 19:58 ` H. J. Lu [this message]
2005-03-15 20:38 ` H. J. Lu
2005-03-16 2:32 ` H. J. Lu
2005-03-16 2:50 ` Alan Modra
2005-03-17 4:22 ` H. J. Lu
2005-03-17 8:39 ` Alan Modra
2005-03-18 3:15 ` Alan Modra
2005-03-18 3:29 ` H. J. Lu
2005-03-18 3:51 ` Alan Modra
2005-03-18 7:07 ` H. J. Lu
2005-03-18 7:13 ` Alan Modra
2005-03-18 9:59 ` H. J. Lu
2005-03-18 10:14 ` Alan Modra
2005-03-18 15:37 ` H. J. Lu
2005-03-21 8:32 ` Alan Modra
2005-03-18 10:34 ` Alan Modra
2005-03-18 14:53 ` Alan Modra
2005-03-18 17:22 ` H. J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050315195824.GA25667@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).