Commit graph

89 commits

Author SHA1 Message Date
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
Bill Currie
4a680bf981 grovel around for the source file and line of an undefined def to give
better diagnostics
2003-08-06 21:36:07 +00:00
Bill Currie
bfaa07c726 better type mismatch error reporting 2003-05-15 05:19:05 +00:00
Bill Currie
0ebf9d6afc more inline avoidance 2003-05-07 15:00:17 +00:00
Bill Currie
b6b5089ccc add a "nosave" flag to defs making it easier to make defs that don't get
saved automaticly
2003-04-25 17:00:22 +00:00
Bill Currie
f7d806e8d5 can now handle > vector sized parameters 2003-04-22 20:11:16 +00:00
Bill Currie
2f6fc5d80c general revamp so params and the return value use proper defs rather than
hardcoded locations. this will allow use of quaternions in the future.
2003-04-22 15:29:32 +00:00
Bill Currie
6a79ee57c4 the correct fix for overzealous linking: preemptively turf unused externs 2003-03-13 03:18:34 +00:00
Bill Currie
bb1b7c481c don't pull in a lib object file due to an /unused/ undefined def. 2003-03-13 01:50:49 +00:00
Bill Currie
b928f94440 produce a warning if both @self and self are used in the same progs 2003-02-24 20:10:33 +00:00
Bill Currie
5f75aa024a don't relocate a null function constant 2003-02-24 15:33:57 +00:00
Bill Currie
af44b129d6 don't store pointers to defs in the hash table as the defs can move around
due to realloc. can now link large progs
2003-02-21 22:31:40 +00:00
Bill Currie
761a7546dd re-arrange things so __attribute__ and __builtin_expect are properly
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie
71196fedf6 make gcc more anal about prototypes, string constants and function
visibility (ie, global functions must have a prototype)
2003-01-06 18:28:13 +00:00
Bill Currie
1cba65f6ce fix a gcc 2.95 warning 2002-11-04 02:24:28 +00:00
Bill Currie
7f69f593d3 configure.ac:
define default include and lib paths for qfcc
ruamoko:
	{cl_menu,game}/Makefile.am:
		conform to the new qfcc library linking rules
	lib/Makefile.am:
		install the libs to ${prefix}/lib/ruamoko
qfcc:
	linker.[ch]:
		support path searching for -llib and make linker_add_lib search for
		libfoo.a for -lfoo in the paths, or just a single dir search for the
		libname otherwise.
	options.c:
		support -L libpath and setup the default include and lib paths
		also change most strdup calls to save_string
	qfcc.c:
		check for foo.a as well as -lfoo when deciding whether the file is
		an object file or lib file.
2002-11-01 18:05:12 +00:00
Bill Currie
7af99f422f expr.c:
fix a braino that caused only sizeof expr to work
linker.c:
	print an error message if unable to open the lib
qc-parse.y:
	revamp expression parsing so casting is done via (type)expr rather than
	type(expr)
	make it so pointers to pointers don't need ()s
2002-10-31 22:58:59 +00:00
Bill Currie
9d8d570269 using Qseek on a pak sub-file should work better. this should make oggs in
paks work.
2002-09-27 04:27:19 +00:00
Bill Currie
d8a38ae648 don't fuss with function defs that aren't initialized 2002-09-19 06:01:06 +00:00