Hi, On Wed, 24 Jun 2009, Jeff Mahoney wrote:
iterates over all of them in order. The linker script can make sure that all these .initcall sections are lying next to each other (i.e. just remain separate in the ELF section list), so that the current code doesn't even need to be changed, if I'm reading it right.
The linker script does this now, but it also consolidates them into one .initcall section. AFAIK the only down side to not consolidating it anymore is using extra ELF header space.
Exactly.
I've only looked at a few arches, but it looks like we don't use the section headers for freeing the initmem.
Right, AFAICS (and I have looked at even less arches :) ) the initcall walker is driven just by the _initcall_start and _initcall_end symbols, not by section headers.
all things in module-lump will run after vmlinux things of the same level L. If that isn't wanted you need to introduce a new level L-0.5 for the module-lump things, at voila, they are run before the vmlinux things at level L.
How much trouble would we run into if we kept the original initcall sections in vmlinux?
Into none I would think ...
Would the initcall sections in the module properly merge into them? Or are we already too late and the relocation records are lost?
... because this is not the case, the modules are .o files, not fully linked, so all relocations are still there.
Yes, understood. I don't see why that wouldn't be possible with the lumping together anymore, under the condition that modules will contain the original initcall sections in the future.
And this bit is trivial. I already have a patch doing that on my development node.
The big problem I've been running into is wrangling the complex linker script into something we can use for the secondary linking.
So, what's the nature of the problem? Just wrapping your head around the many sections and ALIGN directives, or something principle as in "result doesn't work and I don't know why"? Theoretically (as the sections of .ko have all the right attributes already) all that should be needed is "ld -r -o lump.ko input1.ko input2.ko ...". This currently fails because of multiply defined symbols on at least __mod_pci_device_table, init_module and cleanup_module. That must be solved in module build time or by renaming symbols. Probably making them static is the right way, a pointer to those functions is already embedded in the this_module section. Another problem will be the .gnu.linkonce.this_module sections. ld -r will simply select one of the input ones, and not merge them. That requires probably renaming this section (I have no idea why it is linkonce anyway, kernel modules are .o files, not fully linked, so there is only ever one copy of each section, with or without linkonce marking). It seems that currently __mod_pci_device_table is not referred to via some pointer in some module descriptor, but rather explicitely by symbol name in the loader. That's not going to work as when you lump multiple modules together you would have multiple of those. I would embed a pointer to that table into the module descriptor. For loading of the lump it's probably useful if you mark the start and end of all collected module descriptors (the this_module sections) in the usual way, by this_module_start/_end symbols (or strip them away, no idea what would be better as I don't know what vital information is contained therein). Ciao, Michael. -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org