public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>,
	ebiederm@xmission.com, linux-kernel@vger.kernel.org,
	Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Subject: Re: [RFC] Consolidate vmlinux.lds.S files
Date: 13 Jan 2003 12:10:11 -0700	[thread overview]
Message-ID: <m1vg0sg92k.fsf@frodo.biederman.org> (raw)
In-Reply-To: <20030113180450.GA1870@mars.ravnborg.org>

Sam Ravnborg <sam@ravnborg.org> writes:

> On Mon, Jan 13, 2003 at 12:36:32AM +0100, Ingo Oeser wrote:
> > Hi,
> > 
> > > This is first version, where I have converted i386, s390 and sparc64.
> > > The latter two is not tested, only to make sure it can be used by more
> > > than one platform.
> > 
> > Liker scripts are hard enough to read, so I would not like to see
> > more CPP magic here. Consolidation should stop, where the
> > readability stops.
> 
> Hi Ingo & Eric.
> 
> The purpose was to define common stuff in a single place.
> Ask Rusty Russell if it is fun to add the same section to > 50
> .lds files.
> 
> Based on the feedback I will try to come up with a lighter proposal,
> that does not hurt readability.
> I still want the common stuff separated away.
> 
> And I will in the process try to add a bit more descriptive comments,
> I agree the linker scripts are hard to read today. It would help if people
> cared to spend a few more lines explaning the actual usage.
> Having such explanation in a common place would make the chances for
> an update of the comments bigger.

I consider it a bigger bug that CodingStyle is not followed.  If there
was an appropriate amount of whitespace linker scripts would be easier
to read.

Beyond that linker scripts native support include directives.  And included
files can have additional SECTIONS attributes.  In particular:

SECTIONS {
        .section1 {
		*(.section1)                       
        }
}
SECTIONS {
	.section2 {
		*(.section2)
        }
}

is legal.

So I would recommend having an arch specific linker script that included
the architecture independent parts.  And have each part have it's own
SECTIONS attribute tag.

Something like:

---- arch/i386/vmlinux.lds.S ----
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
vmlinux.lds.S
jiffies = jiffies_64;
SECTIONS
{
	. = 0xC0000000 + 0x100000;
	/* read-only */
	_text = .;                    /* Text and read-only data */
	.text : {
        	*(.text)
        	*(.fixup)
        	*(.gnu.warning)
        } = 0x9090

	_etext = .;                   /* End of text section */
	.rodata : { *(.rodata) *(.rodata.*) }
	.kstrtab : { *(.kstrtab) }
}
INCLUDE ../../kernel/exceptions.lds
INCLUDE ../../init/initramfs.lds

---- kernel/exceptions.lds ----
SECTIONS {
	. = ALIGN(16);                /* Exception table */
	__start___ex_table = .;
	__ex_table : { *(__ex_table) }
	__stop___ex_table = .;
}

---- init/initramfs.lds ----
SECTIONS {
	. = ALIGN(4096);
	__initramfs_start = .;
	.init.ramfs : { *(.init.ramfs) }
	__initramfs_end = .;
}

Eric

  reply	other threads:[~2003-01-13 19:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-12 22:07 [RFC] Consolidate vmlinux.lds.S files Sam Ravnborg
2003-01-12 23:09 ` Jeff Garzik
2003-01-12 23:36 ` Ingo Oeser
2003-01-13 18:04   ` Sam Ravnborg
2003-01-13 19:10     ` Eric W. Biederman [this message]
2003-01-13 22:11       ` Sam Ravnborg
2003-01-13 19:13     ` Kai Germaschewski
2003-01-13 19:37       ` David Mosberger
2003-01-13 20:30         ` Kai Germaschewski
2003-01-13 21:17           ` David Mosberger
2003-01-14  1:54         ` Eric W. Biederman
2003-01-14  2:18           ` PPP problem with >= 2.4.19 JunHyeok Heo
2003-01-14  5:23             ` Steve Lee
2003-01-15 22:42         ` [RFC] Consolidate vmlinux.lds.S files Kai Germaschewski
2003-01-16  0:19           ` Eric W. Biederman
2003-01-13 22:19       ` Sam Ravnborg
2003-01-13 23:05         ` Kai Germaschewski
2003-01-13 10:19 ` dada1
2003-01-13 18:08   ` Sam Ravnborg
2003-01-13 11:24 ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2003-01-14  6:27 Mikael Starvik

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=m1vg0sg92k.fsf@frodo.biederman.org \
    --to=ebiederm@xmission.com \
    --cc=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /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