Commit graph

107 commits

Author SHA1 Message Date
Bill Currie
2565e0db32 Update reloc targets when linking. 2011-03-04 21:29:47 +09:00
Bill Currie
e04f6266b1 Nuke def_list from defref_t.
It didn't work :/.
2011-03-04 20:40:01 +09:00
Bill Currie
2211a807d4 Do not relocate builtin functions. 2011-03-04 18:46:25 +09:00
Bill Currie
9a96febdf5 Fix the hordes of bogus defs.
They were caused by unused external defs, so not processing unused externs
in the first place is the simplest solution.
2011-03-04 14:51:09 +09:00
Bill Currie
7b7f4c70e0 Correct non-external def processing. 2011-03-04 14:33:03 +09:00
Bill Currie
c5dac6d1d1 Transfer the type encoding.
oops
2011-03-04 14:29:22 +09:00
Bill Currie
e525727a24 Add a null type descriptor to the linker output. 2011-03-04 11:38:33 +09:00
Bill Currie
3a828ca5c2 Ensure work spaces are always connected to their data. 2011-03-04 11:18:56 +09:00
Bill Currie
29985efcef Expose some linker functions to the rest of the compiler.
They proved to be useful for cleaning up the final compilation stages.
2011-03-02 20:48:55 +09:00
Bill Currie
065d3e0dd7 Partial linking for a single qfo file now seems to work. 2011-03-02 14:03:41 +09:00
Bill Currie
bfeece3255 Fix the bogus declarations of obj_msgSend and obj_msgSend_super. 2011-03-02 12:35:10 +09:00
Bill Currie
fda46a4aca Handle the special defs. 2011-03-02 12:26:53 +09:00
Bill Currie
54317965cc Handle relocs.
With this, the building of the work qfo seems to be almost finished, just
the special defs to go. Next step will be to stitch all the parts of the
work qfo into a real qfo.

However, still have to fix the relocs for the type descriptors, but they
are not critical to the linker's functioning.
2011-03-02 11:16:35 +09:00
Bill Currie
8669dc373f Add some documentation. 2011-03-02 11:13:44 +09:00
Bill Currie
65bd215058 Minor rearrangements. 2011-03-01 15:35:14 +09:00
Bill Currie
2cb1c74718 More progress on the linker.
Need to finish up defs and handle relocs, and then take care of special
defs (@self etc), but things are getting very close.
2011-03-01 15:18:47 +09:00
Bill Currie
c36919aae7 Fix verbosity and diagnostic messages. 2011-03-01 11:08:32 +09:00
Bill Currie
cfff2b1037 Add defs from near and far data spaces. 2011-03-01 10:52:27 +09:00
Bill Currie
21558864b9 Make defrefs a little more stupid.
Stupid code does little well :P

I forgot that spaces get realloced, and I don't remember why I had the def
list pointer separate anyway.
2011-03-01 09:19:04 +09:00
Bill Currie
1416b996d3 Ensure the type space pointer is cleared with each object file. 2011-03-01 09:18:09 +09:00
Bill Currie
30272968c9 Update the def's type pointer. 2011-03-01 09:17:32 +09:00
Bill Currie
1837518d05 Split the space processing into two passes.
This allows strings and types to be handled before code and data.
2011-03-01 08:48:58 +09:00
Bill Currie
eb11a19ed4 Split the type processing into two passes.
This allows all duplicate types to be "merged" before adding any new
types, thus avoiding any accidental duplication caused by possible
differences in order between defs and the type descriptors.
2011-03-01 08:46:02 +09:00
Bill Currie
05e6f00e72 Initialize the new type def.
Oops :P
2011-03-01 08:16:14 +09:00
Bill Currie
3761cddca6 Finally, some real progress on the linker.
There is still much to be done, but this seems to be a workable approach.
2011-02-28 23:18:07 +09:00
Bill Currie
8b661bbb89 Rename qfo_reloc_t's def to target and correct its usage. 2011-02-27 11:37:24 +09:00
Bill Currie
f362e74f98 Update the header. 2011-02-24 15:24:35 +09:00
Bill Currie
c10a551c84 Rename new_defspace() and defspace_new_loc(). 2011-02-24 13:07:36 +09:00
Bill Currie
66b255afbf First stage of the linker rewrite.
Strings, code and data spaces are "merged". Various offsets are updated.
Still to do:
 o  Merge reloc, def, function and line data.
 o  Merge type data.
 o  Update def and function type pointers.
 o  Resolve external defs and check for duplicate defs.
 o  Perform relocations.
 o  anything else I've forgotten :)
2011-02-24 12:18:35 +09:00
Bill Currie
a1ea492889 Remove some redundant fields from qfo objects. 2011-02-23 10:40:35 +09:00
Bill Currie
bceb98e5a4 Create structures for new qfo format.
This breaks a lot of existing code, so that code has been commented out
for now.
2011-02-17 15:02:09 +09:00
Bill Currie
0624408317 Move the diagnostic functions into their own file. 2011-01-24 21:54:57 +09:00
Bill Currie
ea3895805b Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.

emit.c has been gutted in the spirit of "throw one away".

There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
Bill Currie
75ec6bf244 Clean out some unnecessary types from the progs engine and clean up the mess.
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
9ac15436d9 More docs.
Enhance qfprogs qfo debugging.

Make sure functions marked as extern don't emit anything. Fixes the segfault
when building klik.
2008-08-01 13:54:24 +00:00
Bill Currie
3b7c83a96f uncomment some lines that shouldn't have been commented (doesn't fix the bug, though) 2007-04-09 14:32:47 +00:00
Bill Currie
3cd01223dd don't try to fix up function refs too early. fixes klik's segfault on firing 2007-04-09 08:56:23 +00:00
Bill Currie
9509d0fd5e make qfo files typesize safe 2007-04-07 12:35:03 +00:00
Bill Currie
0382b05780 various unsigned long -> uintptr_t conversions 2007-04-04 11:22:48 +00:00
Bill Currie
3fb03fc2be hah, should have been using __attribute__((used)) all that time (rather
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
4d044bfea4 make entity.vector.x work properly by making relative field offset work. also don't emit a field def for the resulting immediate
This is an imperfect revision of history.
2004-11-12 10:49:00 +00:00
Bill Currie
ca46503607 add -Wsign-compare (default for -Wall only in C++) and fix up the warnings 2004-07-13 19:14:01 +00:00
Bill Currie
8a7bb9c4a0 fix a silly that messed up type mismatch errors 2004-04-12 23:46:21 +00:00
Bill Currie
0b61dae402 allow .imm fields (need a better test, I think) 2004-04-09 03:45:55 +00:00
Bill Currie
8f440c7911 linker.c:
I think I found the real reason doxygen gets confused
expr.c:
	add a check for x & y == 2 (or similar) doesn't work for constant y at
	the moment.
2004-01-22 01:04:48 +00:00
Bill Currie
41106a1f01 hopefully shut doxygen up about a "const char" function 2004-01-11 05:52:19 +00:00
Bill Currie
ef4ca0c798 some doxygen tweaks 2003-08-31 05:24:24 +00:00
Bill Currie
b38486d405 make rel_def_op work properly 2003-08-22 19:48:14 +00:00
Bill Currie
11c7c27f70 better relocations: pointers to structure members now work 2003-08-21 02:21:30 +00:00
Bill Currie
a2300387de fix a bunch of segfaults 2003-08-20 22:36:02 +00:00