public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Subject: Re: PATCH: PR 797: Alignment in empty section changes the output layout
Date: Thu, 05 May 2005 16:12:00 -0000	[thread overview]
Message-ID: <20050505160223.GA28959@lucon.org> (raw)
In-Reply-To: <20050505055616.GL22611@bubble.grove.modra.org>

On Thu, May 05, 2005 at 03:26:16PM +0930, Alan Modra wrote:
> On Wed, May 04, 2005 at 10:35:44PM -0700, H. J. Lu wrote:
> > On Thu, May 05, 2005 at 02:44:56PM +0930, Alan Modra wrote:
> > > On Wed, May 04, 2005 at 09:48:17PM -0700, H. J. Lu wrote:
> > > > On Thu, May 05, 2005 at 12:07:17PM +0930, Alan Modra wrote:
> > > > > Can you please look at merging lang_mark_used_section and
> > > > > strip_unused_output_sections into strip_excluded_output_sections?
> > > > > 
> > > > > I think it should be possible if you call lang_do_assignments before
> > > > > bfd_gc_sections to ensure that linker script symbols defined inside
> > > > > output sections are in the hash table.
> > > > 
> > > > I am not sure it will work since the order is quite important. I
> > > > got many
> > > > 
> > > > /export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new:
> > > > tmpdir/ld1: Not enough room for program headers (allocated 2, need 4)
> > > > /export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new: final link
> > > > failed: Bad value
> > > 
> > > Did you find that you needed to run lang_size_sections early as well?
> > > If so, see emultempl/ppc64elf.em:ppc_before_allocation for what needs to
> > > be undone.
> > 
> > Same problem. ldemul_before_allocation is called after
> > map_input_to_output_sections. I guess it is hard to call
> > lang_do_assignments before it. Besides, it makes lang_process even
> > more complicated.
> 
> I meant for you to call lang_do_assignments, bfd_gc_sections and
> strip_unused_output_sections from strip_excluded_output_sections.  Is
> that what you're doing?
> 

With

  lang_size_sections (statement_list.head, abs_output_section,
                      &statement_list.head, 0, 0, NULL,
                      command_line.relax ? FALSE : TRUE);
  lang_do_assignments (statement_list.head, abs_output_section, NULL,
0);
  lang_reset_memory_regions ();
  lang_mark_used_section ();
  strip_unused_output_sections ();

at the end of strip_excluded_output_sections, I got

Running
/export/gnu/src/binutils/binutils/ld/testsuite/ld-scripts/phdrs.exp ...
/export/build/gnu/binutils-debug/build-i686-linux/ld/../gas/as-new   -o
tmpdir/phdrs.o
/export/gnu/src/binutils/binutils/ld/testsuite/ld-scripts/phdrs.s
/export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new  -o
tmpdir/phdrs -T
/export/gnu/src/binutils/binutils/ld/testsuite/ld-scripts/phdrs.t
tmpdir/phdrs.o/export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new:
tmpdir/phdrs: Not enough room for program headers (allocated 2, need 3)
/export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new: final link
failed: Bad value FAIL: PHDRS

and

Running
/export/gnu/src/binutils/binutils/ld/testsuite/ld-scripts/phdrs2.exp
.../export/build/gnu/binutils-debug/build-i686-linux/ld/../gas/as-new
-o tmpdir/phdrs2.o
/export/gnu/src/binutils/binutils/ld/testsuite/ld-scripts/phdrs2.s
/export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new  -o
tmpdir/phdrs2 -T
/export/gnu/src/binutils/binutils/ld/testsuite/ld-scripts/phdrs2.t
tmpdir/phdrs2.o
/export/build/gnu/binutils-debug/build-i686-linux/ld/../binutils/objdump
--private tmpdir/phdrs2

tmpdir/phdrs2:     file format elf32-i386

Program Header:
    LOAD off    0x00001000 vaddr 0x00800000 paddr 0x00800000 align
2**12
         filesz 0x00000004 memsz 0x00000004 flags r-x
    LOAD off    0x00001000 vaddr 0x00000000 paddr 0x00000000 align
2**12
         filesz 0x0080000c memsz 0x0080000c flags rw-

FAIL: PHDRS2


H.J.

  reply	other threads:[~2005-05-05 16:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-04 19:53 H. J. Lu
2005-05-05  3:48 ` Alan Modra
2005-05-05  4:52   ` H. J. Lu
2005-05-05  5:35     ` Alan Modra
2005-05-05  5:56       ` H. J. Lu
2005-05-05  6:33         ` Alan Modra
2005-05-05 16:12           ` H. J. Lu [this message]
2005-05-06  6:20             ` Alan Modra
2005-05-07 19:16               ` H. J. Lu
2005-05-07 20:08                 ` H. J. Lu
2005-05-17 15:13                   ` Nick Clifton
  -- strict thread matches above, loose matches on Subject: below --
2005-03-24 11:45 H. J. Lu
2005-03-25  2:22 ` H. J. Lu
2005-03-29  4:21   ` Alan Modra
2005-03-29  7:13     ` H. J. Lu
2005-03-29  8:12       ` Alan Modra
2005-03-30 16:30         ` 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=20050505160223.GA28959@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).