[lkml]   [2003]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: common RODATA in (2.5.59)
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/, 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 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.]



Here's my rewrite of include/asm-generic/

#define LOAD_OFFSET 0


#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. */
*(.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 */ \

/* A standalone section containing RODATA_CONTENTS. */
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \

Suburbia: where they tear out the trees and then name streets after them.
 \ /
  Last update: 2005-03-22 13:32    [W:0.061 / U:34.344 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site