mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
implement partial linking (doesn't work any better than full, though :P)
This commit is contained in:
parent
33b3fd1887
commit
ce8f071b7c
4 changed files with 22 additions and 10 deletions
|
@ -64,6 +64,7 @@ typedef struct {
|
|||
qboolean files_dat; // generate files.dat
|
||||
qboolean traditional; // behave more like qcc
|
||||
qboolean compile; // serparate compilation mode
|
||||
qboolean partial_link; // partial linking
|
||||
int strip_path; // number of leading path elements to strip
|
||||
// from source file names
|
||||
const char *output_file;
|
||||
|
|
|
@ -49,6 +49,7 @@ static const char rcsid[] =
|
|||
#include "immediate.h"
|
||||
#include "linker.h"
|
||||
#include "obj_file.h"
|
||||
#include "options.h"
|
||||
#include "qfcc.h"
|
||||
#include "reloc.h"
|
||||
#include "strpool.h"
|
||||
|
@ -353,13 +354,15 @@ linker_finish (void)
|
|||
qfo_t *qfo;
|
||||
|
||||
undef_defs = (qfo_def_t **) Hash_GetList (extern_defs);
|
||||
for (def = undef_defs; *def; def++) {
|
||||
pr.source_file = (*def)->file;
|
||||
pr.source_line = (*def)->line;
|
||||
error (0, "undefined symbol %s", strings->strings + (*def)->name);
|
||||
if (!options.partial_link) {
|
||||
for (def = undef_defs; *def; def++) {
|
||||
pr.source_file = (*def)->file;
|
||||
pr.source_line = (*def)->line;
|
||||
error (0, "undefined symbol %s", strings->strings + (*def)->name);
|
||||
}
|
||||
if (pr.error_count)
|
||||
return 0;
|
||||
}
|
||||
if (pr.error_count)
|
||||
return 0;
|
||||
|
||||
qfo = qfo_new ();
|
||||
qfo_add_code (qfo, code->code, code->size);
|
||||
|
|
|
@ -83,6 +83,7 @@ static const char *short_options =
|
|||
"l:" // lib file
|
||||
"o:" // output file
|
||||
"c" // separate compilation
|
||||
"r" // partial linking
|
||||
"s:" // source dir
|
||||
"P:" // progs.src name
|
||||
"F" // generate files.dat
|
||||
|
@ -211,6 +212,9 @@ DecodeArgs (int argc, char **argv)
|
|||
case 'c': // traditional
|
||||
options.compile = true;
|
||||
break;
|
||||
case 'r': // traditional
|
||||
options.partial_link = true;
|
||||
break;
|
||||
case 'C':{ // code options
|
||||
char *opts = strdup (optarg);
|
||||
char *temp = strtok (opts, ",");
|
||||
|
|
|
@ -547,10 +547,14 @@ separate_compile (void)
|
|||
}
|
||||
qfo = linker_finish ();
|
||||
if (qfo) {
|
||||
qfo_to_progs (qfo, &pr);
|
||||
setup_sym_file (options.output_file);
|
||||
finish_compilation ();
|
||||
WriteData (0);
|
||||
if (options.partial_link) {
|
||||
qfo_write (qfo, options.output_file);
|
||||
} else {
|
||||
qfo_to_progs (qfo, &pr);
|
||||
setup_sym_file (options.output_file);
|
||||
finish_compilation ();
|
||||
WriteData (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
|
Loading…
Reference in a new issue