mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Take parameters -pic -pie from commandline.
This commit is contained in:
@@ -269,6 +269,38 @@ static void parse_option(BuildOptions *options)
|
||||
return;
|
||||
}
|
||||
FAIL_WITH_ERR("Unknown debug argument -%s.", ¤t_arg[1]);
|
||||
case 'f':
|
||||
if (match_shortopt("fpie"))
|
||||
{
|
||||
options->pie = PIE_SMALL;
|
||||
return;
|
||||
}
|
||||
if (match_shortopt("fPIE"))
|
||||
{
|
||||
options->pie = PIE_BIG;
|
||||
return;
|
||||
}
|
||||
if (match_shortopt("fno-pie"))
|
||||
{
|
||||
options->pie = PIE_NONE;
|
||||
return;
|
||||
}
|
||||
if (match_shortopt("fpic"))
|
||||
{
|
||||
options->pic = PIC_SMALL;
|
||||
return;
|
||||
}
|
||||
if (match_shortopt("fPIC"))
|
||||
{
|
||||
options->pic = PIC_BIG;
|
||||
return;
|
||||
}
|
||||
if (match_shortopt("fno-pic"))
|
||||
{
|
||||
options->pic = PIC_NONE;
|
||||
return;
|
||||
}
|
||||
FAIL_WITH_ERR("Unknown argument -%s.", ¤t_arg[1]);
|
||||
case 'h':
|
||||
break;
|
||||
case 'O':
|
||||
@@ -421,6 +453,8 @@ BuildOptions parse_arguments(int argc, const char *argv[])
|
||||
.debug_info_override = DEBUG_INFO_NOT_SET,
|
||||
.safe_mode = -1,
|
||||
.command = COMMAND_MISSING,
|
||||
.pie = PIE_DEFAULT,
|
||||
.pic = PIC_DEFAULT,
|
||||
.files = NULL
|
||||
};
|
||||
for (int i = DIAG_NONE; i < DIAG_WARNING_TYPE; i++)
|
||||
|
||||
@@ -173,6 +173,8 @@ typedef struct BuildOptions_
|
||||
unsigned version;
|
||||
CompilerCommand command;
|
||||
CompileOption compile_option;
|
||||
PieGeneration pie;
|
||||
PicGeneration pic;
|
||||
DiagnosticsSeverity severity[DIAG_END_SENTINEL];
|
||||
OptimizationSetting optimization_setting_override;
|
||||
DebugInfo debug_info_override;
|
||||
@@ -186,7 +188,6 @@ typedef struct BuildOptions_
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TARGET_TYPE_EXECUTABLE,
|
||||
|
||||
@@ -82,6 +82,8 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
|
||||
{
|
||||
target->arch_os_target = options->arch_os_target_override;
|
||||
}
|
||||
if (options->pie != PIE_DEFAULT) target->pie = options->pie;
|
||||
if (options->pic != PIC_DEFAULT) target->pic = options->pic;
|
||||
target->emit_llvm = options->emit_llvm;
|
||||
switch (options->compile_option)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user