Adding missing symtab size option.

This commit is contained in:
Christoffer Lerno
2021-12-24 23:15:50 +01:00
parent f6de1f7b74
commit 85ee021585
3 changed files with 11 additions and 1 deletions

View File

@@ -420,6 +420,15 @@ static void parse_option(BuildOptions *options)
error_exit("error: The TinyBackend is not supported on this platform.");
#endif
}
if (match_longopt("symtab"))
{
if (at_end() || next_is_opt()) error_exit("error: --symtab needs a valid integer.");
const char *symtab_string = next_arg();
int symtab = atoi(symtab_string);
if (symtab < 1024) OUTPUT("Expected a valid positive integer >= 1024.");
options->symtab_size = next_highest_power_of_2(symtab);
return;
}
if (match_longopt("version"))
{
print_version();

View File

@@ -188,6 +188,7 @@ typedef struct BuildOptions_
const char* project_name;
const char* target_select;
const char* path;
uint32_t symtab_size;
unsigned version;
CompilerBackend backend;
CompilerCommand command;

View File

@@ -156,7 +156,7 @@ void init_default_build_target(BuildTarget *target, BuildOptions *options)
.name = options->output_name,
.optimization_level = OPTIMIZATION_DEFAULT,
.size_optimization_level = SIZE_OPTIMIZATION_NONE,
.symtab_size = DEFAULT_SYMTAB_SIZE,
.symtab_size = options->symtab_size ? options->symtab_size : DEFAULT_SYMTAB_SIZE,
.switchrange_max_size = DEFAULT_SWITCHRANGE_MAX_SIZE,
.debug_info = DEBUG_INFO_NONE,
.arch_os_target = ARCH_OS_TARGET_DEFAULT,