mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 08:41:11 +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 files_dat; // generate files.dat
|
||||||
qboolean traditional; // behave more like qcc
|
qboolean traditional; // behave more like qcc
|
||||||
qboolean compile; // serparate compilation mode
|
qboolean compile; // serparate compilation mode
|
||||||
|
qboolean partial_link; // partial linking
|
||||||
int strip_path; // number of leading path elements to strip
|
int strip_path; // number of leading path elements to strip
|
||||||
// from source file names
|
// from source file names
|
||||||
const char *output_file;
|
const char *output_file;
|
||||||
|
|
|
@ -49,6 +49,7 @@ static const char rcsid[] =
|
||||||
#include "immediate.h"
|
#include "immediate.h"
|
||||||
#include "linker.h"
|
#include "linker.h"
|
||||||
#include "obj_file.h"
|
#include "obj_file.h"
|
||||||
|
#include "options.h"
|
||||||
#include "qfcc.h"
|
#include "qfcc.h"
|
||||||
#include "reloc.h"
|
#include "reloc.h"
|
||||||
#include "strpool.h"
|
#include "strpool.h"
|
||||||
|
@ -353,13 +354,15 @@ linker_finish (void)
|
||||||
qfo_t *qfo;
|
qfo_t *qfo;
|
||||||
|
|
||||||
undef_defs = (qfo_def_t **) Hash_GetList (extern_defs);
|
undef_defs = (qfo_def_t **) Hash_GetList (extern_defs);
|
||||||
for (def = undef_defs; *def; def++) {
|
if (!options.partial_link) {
|
||||||
pr.source_file = (*def)->file;
|
for (def = undef_defs; *def; def++) {
|
||||||
pr.source_line = (*def)->line;
|
pr.source_file = (*def)->file;
|
||||||
error (0, "undefined symbol %s", strings->strings + (*def)->name);
|
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 = qfo_new ();
|
||||||
qfo_add_code (qfo, code->code, code->size);
|
qfo_add_code (qfo, code->code, code->size);
|
||||||
|
|
|
@ -83,6 +83,7 @@ static const char *short_options =
|
||||||
"l:" // lib file
|
"l:" // lib file
|
||||||
"o:" // output file
|
"o:" // output file
|
||||||
"c" // separate compilation
|
"c" // separate compilation
|
||||||
|
"r" // partial linking
|
||||||
"s:" // source dir
|
"s:" // source dir
|
||||||
"P:" // progs.src name
|
"P:" // progs.src name
|
||||||
"F" // generate files.dat
|
"F" // generate files.dat
|
||||||
|
@ -211,6 +212,9 @@ DecodeArgs (int argc, char **argv)
|
||||||
case 'c': // traditional
|
case 'c': // traditional
|
||||||
options.compile = true;
|
options.compile = true;
|
||||||
break;
|
break;
|
||||||
|
case 'r': // traditional
|
||||||
|
options.partial_link = true;
|
||||||
|
break;
|
||||||
case 'C':{ // code options
|
case 'C':{ // code options
|
||||||
char *opts = strdup (optarg);
|
char *opts = strdup (optarg);
|
||||||
char *temp = strtok (opts, ",");
|
char *temp = strtok (opts, ",");
|
||||||
|
|
|
@ -547,10 +547,14 @@ separate_compile (void)
|
||||||
}
|
}
|
||||||
qfo = linker_finish ();
|
qfo = linker_finish ();
|
||||||
if (qfo) {
|
if (qfo) {
|
||||||
qfo_to_progs (qfo, &pr);
|
if (options.partial_link) {
|
||||||
setup_sym_file (options.output_file);
|
qfo_write (qfo, options.output_file);
|
||||||
finish_compilation ();
|
} else {
|
||||||
WriteData (0);
|
qfo_to_progs (qfo, &pr);
|
||||||
|
setup_sym_file (options.output_file);
|
||||||
|
finish_compilation ();
|
||||||
|
WriteData (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue