[cc65] .global vs .export vs what i really need :)

From: Groepaz <groepaz1gmx.net>
Date: 2009-10-23 21:42:27
yay,

while testing my work-in-progress size optimizer program i came to the 
conclusion that i hit a limitation of the assembler, which makes it kinda 
tedious if not impossible to cleanly do what i want/need to do. this is the 
problem:

the optimizer moves around small pieces of code, which means that often labels 
will be referenced from a totally different place as before. the consequence 
is that i need to tell the assembler somehow that this symbol exists, ie i 
need to add the equivalent of a c prototype kindof. to do this there are 
currently two pseudo operators, .global and .export (and .import, but that 
doesnt make sence since the symbol is internal). this works for the most part 
and gets the job done nicely. BUT, and thats really a let down, it means that 
in the resulting (object)file a lot of symbols will be marked as export which 
really shouldnt be marked as such. this doesnt matter much on first sight, 
but once you want to run two files seperatly through the optimizer and then 
link them together you will get conflicts on eg compiler generated symbols 
(LXXXX labels etc)... bummer

so, what i really need is a way to tell the assembler "this symbol is 
global/does exist in this file - but should NOT be exported from the 
resulting object file" (actually i assumed .global works like that, because 
it does so in other assemblers i have used, until i found out it doesnt =P)

mmh, since .global is already used, maybe you can add something 
like .proto / .protozp that does this? or is there infact a way to achive 
this with the existing stuff and i am just too dumb to read the docs? :)

and last not least as a teaser, this is from skoe's easyprog tool, compiled 
with -O, and then run through the optimizer:

result: 8563 bytes, old: 10711 (2148 saved, 20%) time:374s

besides the fact that its still kinda slow and needs some optimization itself, 
it looks really promosing right now (similar results for every arbitrary 
program i checked so far). i really want to get this working 100% and then 
mess around with eg contiki :)

-- 

http://www.hitmen-console.org    http://magicdisk.untergrund.net
http://www.pokefinder.org        http://ftp.pokefinder.org

I do not believe in a personal God and I have never denied this but have 
expressed it clearly. 
<Albert Einstein>

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Oct 23 21:41:54 2009

This archive was generated by hypermail 2.1.8 : 2009-10-23 21:41:56 CEST