From: Miles Bader <miles@lsi.nec.co.jp>
To: Greg Ungerer <gerg@snapgear.com>
Cc: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>,
linux-kernel@vger.kernel.org
Subject: Re: common RODATA in vmlinux.lds.h (2.5.59)
Date: 22 Jan 2003 13:32:10 +0900 [thread overview]
Message-ID: <buoptqp954l.fsf@mcspd15.ucom.lsi.nec.co.jp> (raw)
In-Reply-To: <3E2E0F38.7090506@snapgear.com>
[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]
Yeah, the new generic RODATA stuff is way broken on the v850 too.
Besides the over-eager use of sections, it also assumes that C symbol
names map one-to-one with `linker symbol' names, which isn't true with
the default v850 compiler.
Here's my local rewrite of include/asm-generic/vmlinux.lds.h, which
works on the v850, and seems like it should be usable by other systems
as well.
It does two things:
(1) Separates the RODATA stuff into two macros, an input-sections-and-
symbols macro, RODATA_CONTENTS, which can be put into any
appropriate section, and a RODATA_SECTION macro, which simply
defines an appropriate section using that. I guess most archs
could just use RODATA_SECTION in the same way they use `RODATA'
now, but the v850 uses RODATA_CONTENTS instead.
This assumes that the original division into lots of little
output sections was gratuitous, and that putting everything into
a single section is OK.
[You might notice that this follows the macro scheme already used
by the v850's vmlinux.lds.S file]
(2) Adds a `CSYM' macro which is used for every symbol name that is
exported to C. By default this just expands to its argument, but
an arch may define `C_SYMBOL_PREFIX' in order to add a prefix to
all C symbols.
What do you think of this?
[To be honest, I think the stuff with `LOAD_OFFSET' is a bit of a waste;
it seems cleaner to just have archs define their own sections as
appropriate, and use RODATA_CONTENTS directly -- it's the input sections
and related symbols that are always changing (and so better centralized),
after all, not the output sections.]
Thanks,
-Miles
Here's my rewrite of include/asm-generic/vmlinux.lds.h:
[-- Attachment #2: My rewrite of include/asm-generic/vmlinux.lds.h --]
[-- Type: text/plain, Size: 1015 bytes --]
#ifndef LOAD_OFFSET
#define LOAD_OFFSET 0
#endif
#ifndef C_SYMBOL_PREFIX
#define C_SYMBOL_PREFIX
#endif
#define __paste(x,y) x##y
#define _paste(x,y) __paste(x,y)
#define CSYM(name) _paste(C_SYMBOL_PREFIX,name)
/* Section contents for read-only data. */
#define RODATA_CONTENTS \
*(.rodata) *(.rodata.*) \
*(__vermagic) /* Kernel version magic */ \
*(.rodata1) \
/* Kernel symbol table: Normal symbols */ \
CSYM(__start___ksymtab) = .; \
*(__ksymtab) \
CSYM(__stop___ksymtab) = .; \
/* Kernel symbol table: GPL-only symbols */ \
CSYM(__start___gpl_ksymtab) = .; \
*(__gpl_ksymtab) \
CSYM(__stop___gpl_ksymtab) = .; \
/* Kernel symbol table: strings */ \
*(__ksymtab_strings)
/* A standalone section containing RODATA_CONTENTS. */
#define RODATA_SECTION \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
RODATA_CONTENTS \
}
[-- Attachment #3: Type: text/plain, Size: 81 bytes --]
--
Suburbia: where they tear out the trees and then name streets after them.
next prev parent reply other threads:[~2003-01-22 4:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-22 2:05 Greg Ungerer
2003-01-22 2:49 ` Kai Germaschewski
2003-01-22 3:25 ` Greg Ungerer
2003-01-22 4:32 ` Miles Bader [this message]
2003-01-22 4:47 ` Greg Ungerer
2003-01-22 5:42 ` Sam Ravnborg
2003-01-22 6:00 ` Miles Bader
2003-01-22 5:55 ` Kai Germaschewski
2003-01-22 6:23 ` Miles Bader
2003-01-22 16:32 ` Kai Germaschewski
2003-01-23 2:03 ` Miles Bader
2003-01-23 5:59 ` Greg Ungerer
2003-01-22 6:35 ` Greg Ungerer
2003-01-22 16:35 ` Kai Germaschewski
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=buoptqp954l.fsf@mcspd15.ucom.lsi.nec.co.jp \
--to=miles@lsi.nec.co.jp \
--cc=gerg@snapgear.com \
--cc=kai@tp1.ruhr-uni-bochum.de \
--cc=linux-kernel@vger.kernel.org \
--cc=miles@gnu.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
all inboxes | Powered by JetHome®