"Michael S. Davis" <[EMAIL PROTECTED]> wrote:

> The idea of each module being it's own section [...]

OK, I see you don't understand it. In normal UNIX programming each module is
compiled/assembled normally from normal C or assembly source. In the .o file
all code is in .text, all initialized data is in .data, and all unitialialized
data is in .bss. Then the linker creates an executable, which also has .text,
.data, and .bss. The final executable's .text is .text from all modules
combined together, the same for .data and .bss.

For PalmOS multiple code segments, we need the executable coming out of the
linker (which we call the intermediate file because it really isn't executable
on anything and is instead fed into the post-linker) to have extra code
sections in addition to .text, each representing a code segment. John Marshall
and I differ in ways of achieving this. He makes you send functions off into
different sections at the source level, so that in the .o files they are
already in a section other than .text, and the linker remains a simple one-to-
one section combiner. I, however, want .o files to have only .text, and to make
the linker instead of combining sections one-to-one create new sections on
output and put .text's from different input object modules into different
sections on output as directed by a user-written link script. This capability
is already in the linker. The problem is elsewhere. The problem is that John
has put the decision to generate an intrasegment or an intersegment call or
reference instruction sequence very high in the compiler. This approach is
inherently flawed. Among other things, it precludes link-time shuffling of
sections, requires all sectioning to be done at compile time, and requires
section attributes not just when generating the function body, but also when
calling it, which the architecture is not designed for and which causes
problems like the recently discussed floating point woes.

Instead, the only sensible way to do this is to make the compiler generate and
the assembler suitably encode special magic tokens instead of actual
instructions for *all* calls and references. Then the linker, which must be
relaxing in binutils terminology, will turn these magic tokens into actual
instructions, and as it generates the final executable/intermediate file, it
knows the final word on what goes in what section, thus it will always choose
the correct and optimal instruction sequence.

This will allow you to do sectioning in any way you want: in C source with
section attributes, in assembly with the .section directive, or via link
scripts. Of course, the last method is the best for keeping object modules and
libraries stand-alone and requires no source munging.

--
Michael Sokolov         Harhan Engineering Laboratory
Public Service Agent    International Free Computing Task Force
                        International Engineering and Science Task Force
                        615 N GOOD LATIMER EXPY STE #4
                        DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: [EMAIL PROTECTED] (ARPA TCP/SMTP) (UUCP coming soon)

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to