In article <[EMAIL PROTECTED]>, Gregg Woodcock wrote:
> "John Marshall" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> It might be worth changing the suggested usage to "-Wl,-T,text_64k",
>> which would more reliably warn idiots who (mis)use it at compile-time,
>> but the advantage is offset by the probability of said idiot mistyping
>> all that punctuation and posting questions about that instead :-).
> 
> OK, now that you've had your fun (which is somewhat deserved), hopefully you
> are willling to help me actually figure out WHY this does nothing for me.  I
> started out in the beginning using it in the link phase and it did nothing.
> I tried -t, -T, linker, compiler, EVERYTHING.  Nothing works.  I am trying
> to add a 4K library to my primary code segment.  That's it.  It won't fit in
> the default 32K segment but doubling that is WAY more than enough so that's
> what I want/need to do.  And yet when I do exactly what you have so
> derisively described, it makes no difference.  Not only that, the
> linker/compiler NEVER give any errors at all.  As I said before, I can do
> "-t garbage", "-T garbage" and get nothing to let me know that it is even
> there.  So I have no feedback as to where I might be off track.  All I know
> is I am desperate to get this in and I can't do it and there doesn't seem to
> be any example anywhere online of this in use.
> 
> Armed with the map file I can see that indeed, it is now (and actually
> probably was in the beginning) creating a large(r) coderes segment as
> evidenced by these 2 differences:
> coderes 0x00000000 0x00008002
> coderes 0x00000000 0x0000fcd0
> 
> The reason I assumed it *wasn't* working was because I get the classic
> "coderes is full" error when linking in the FourKLib library.  The library
> itself is actually 23080 bytes but the author told me that this gets trimmed
> by the linker (for my type of use) to about 4K (I am only using 3 functions
> out of the 40 or so).
> 
> So the REAL problem I am having is that the compiler is including ALL the
> library instead of just the pieces I am actually referencing/using.  Perhaps
> I have settings of the linker so that it is not properly discarding unused
> library code?  Evidently what the linker does is allocate space for ALL the
> functions in an included library FIRST and then strips out the actual code
> after the fact.  Therefore I need to be able to fit the entire 23+K into the
> codres even though only 4K or so will end up there.
> 
> So the questions I now have are:
> 
> 1) Is there a way to specify which functions in a library go into which
> segments (remember, all I have is the .h and .a file; it isn't my library)?
> If I modify the .h file with the SECTION_X postfix, will that work?  This
> would seem like my best bet.
>

No, this is not going to work. All routines pulled in from the library will
be in the main code section (.text which becomes coderes 1).
 
> 2) Is there way to force the compiler to evaluate which functions are
> actually used BEFORE it stakes out space for them in the codres so that it
> will not consider unused ones?

If it is a proper library, then that is exactly what the linker will do.
It seems that for some reason the whole library is pulled in. If you link
with -Wl,--verbose you can see which modules are extracted from lib<name>.a.
Also the link map contains this information. Then you will have to figure
out why it pulls in everything.

Some things which might help: Look at the symbol definitions with nm:
'm68k-palmos-nm -s <your lib>'
If there is no library index, create one with 'm68k-palmos-ranlib <your lib>'.

Ton van Overbeek

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to