Commit graph

71 commits

Author SHA1 Message Date
Bill Currie
4a99f8dcbd Write the linker output to progs.dat.
There is much breakage, but qfcc now produces a progs.dat from either
progs.src or object files. Better yet, the progs.src result is passed
through the linker, removing much duplicate code.
2011-03-02 20:51:00 +09:00
Bill Currie
ecb995a8f7 Rewrite qfo_to_progs() to go direct from qfo to progs.dat.
Relocs and debug info is currently broken.
2011-03-02 19:06:43 +09:00
Bill Currie
824d8bfc3c Remove some now unnecessary functions. 2011-03-02 14:21:20 +09:00
Bill Currie
bad7078797 Don't set the space defs pointer if there are no defs. 2011-02-28 23:16:59 +09:00
Bill Currie
5d9fbc2d6d Set the space ids to the destination space.
This is mostly redundant, but it allows qfo spaces to get out of order
without breaking everything.
2011-02-28 23:16:19 +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
a106c1fb51 Add a field for loose relocation records.
Loose relocation records are those that are not bound to a def or a
function.
2011-02-24 15:21:06 +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
74497f00e1 Read qfo object files :) 2011-02-23 18:10:38 +09:00
Bill Currie
33810e9c91 Write out object files in the new format. 2011-02-23 15:05:33 +09:00
Bill Currie
e1158a83f0 Begin work on rewriting obj_file.c for the new format. 2011-02-22 15:42:49 +09:00
Bill Currie
afc5b2827d Simplify def handling, use far data.
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.

Also, start using far data for ObjQC structures.

The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00
Bill Currie
b5424bca7d Start work on getting expressions converted to internal statements. 2011-01-19 15:47:45 +09:00
Bill Currie
87ce9f5333 Get basic function creation working.
Even more FIXMEs, but the pascal parser can now create functions. The
function records even get emitted.
2011-01-18 12:47:13 +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
c8b7622e0e reduce the amount of memory wasted when generating the output file 2009-12-20 12:19:16 +00:00
Bill Currie
c542138300 more not-really initialized data 2009-12-20 11:54:19 +00: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
3e50aae01f "print" command for dumping values in the progs and add return type info to the debugging information 2007-09-15 07:47:31 +00:00
Bill Currie
845b5ab2e2 don't write alias defs to the qfo 2007-04-09 14:25:44 +00:00
Bill Currie
9509d0fd5e make qfo files typesize safe 2007-04-07 12:35:03 +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
f1c9a8d24b remove a mostly unused field 2004-02-21 05:58:01 +00:00
Bill Currie
b38486d405 make rel_def_op work properly 2003-08-22 19:48:14 +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
8f4308c86a get .param_size and .debug_file linked in properly 2003-04-23 18:25:09 +00:00
Bill Currie
44285ba5de speed up qfo writing by about 12.5:1 (for large object files, anyway) by
making compression optional (compressed qfo files will still be handled
transparently)
2003-02-23 23:43:43 +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
ca4b3acd6c big protototype cleanup. Now, except for a few cases, all non-static
prototypes are in headers files.
2002-11-05 19:12:51 +00:00
Bill Currie
5a182b7cd4 turns out that flags == 0 is quite valid (d'oh) 2002-10-16 06:33:14 +00:00
Bill Currie
6af57049d5 make pointers work a bit better 2002-10-16 02:04:06 +00:00
Bill Currie
412db7e27d "for example" is more appropriate than "that is" 2002-09-16 15:42:11 +00:00
Bill Currie
e5227076e0 put in some error checking on the Qopen calls 2002-09-10 15:46:50 +00:00
Bill Currie
ec47e08e1c go back to using QFile, quakeio.h and quakefs.h 2002-08-27 07:16:28 +00:00
Bill Currie
aaab480676 fix a bunch of potential malloc (0) calls 2002-08-25 23:16:07 +00:00
Bill Currie
36ca7b55bd fix several problems caused by insufficient error checking and some double
Qclose calls
2002-08-15 18:53:03 +00:00
Bill Currie
a431a2783c byteswap the reloc def field too (fixes the qfcc seg on big-endian systems) 2002-08-09 04:06:50 +00:00
Bill Currie
1e49f0d0c3 fix a segfault (what was I thinking when I wrote that line?) 2002-07-23 05:44:45 +00:00
Bill Currie
c2a7564d55 implement -l, but -L isn't supported yet and the full lib name must be given 2002-07-21 07:12:17 +00:00
Bill Currie
b0d568d85f local defs for debug info now work 2002-07-17 15:40:08 +00:00
Bill Currie
980be66c0e bah, missed this file 2002-07-17 14:21:52 +00:00
Bill Currie
678a45cfe2 entity fields seem to work. I guess this means separate compilation is now
useful :)
2002-07-16 21:59:47 +00:00
Bill Currie
17c2def821 def merging seems to mostly work (have some problems with method lists) 2002-07-16 06:40:34 +00:00
Bill Currie
b9a237b13d rename qfo_function_t to qfo_func_t and similar for other qfo *function* in
obj_file.[ch]
2002-07-15 21:37:52 +00:00
Bill Currie
e550ad670a more linking fixes, including seting up relocations. not quite working yet 2002-07-13 06:09:03 +00:00
Bill Currie
b48d71fdcc make qfo functions 0 based. now having weird def problems :/ 2002-07-12 22:27:40 +00:00
Bill Currie
2a121d000f fix a couple of dumb bugs and update the function number calculation 2002-07-12 20:43:11 +00:00
Bill Currie
06c03dd074 make local defs always come after global defs in linked qfo files and make
function relocations work better
2002-07-12 20:26:51 +00:00