@@ -67,7 +67,11 @@ pub(crate) unsafe fn codegen(
67
67
) ;
68
68
context. add_command_line_option ( "-flto=auto" ) ;
69
69
context. add_command_line_option ( "-flto-partition=one" ) ;
70
- //context.add_command_line_option("-fno-use-linker-plugin");
70
+ // FIXME FIXME FIXME: it seems that uncommenting "ADD_ARG ("-fno-use-linker-plugin")" in libgccjit
71
+ // make the test fail (undefined symbol main).
72
+ // TODO: Perhaps we're not sending this flag somewhere?
73
+ context. add_command_line_option ( "-fno-use-linker-plugin" ) ;
74
+ context. add_driver_option ( "-fno-use-linker-plugin" ) ;
71
75
// TODO(antoyo): remove since we don't want fat objects when it is for Bitcode only.
72
76
context. add_command_line_option ( "-ffat-lto-objects" ) ;
73
77
context. compile_to_file (
@@ -86,7 +90,8 @@ pub(crate) unsafe fn codegen(
86
90
87
91
context. add_command_line_option ( "-flto=auto" ) ;
88
92
context. add_command_line_option ( "-flto-partition=one" ) ;
89
- //context.add_command_line_option("-fno-use-linker-plugin");
93
+ context. add_command_line_option ( "-fno-use-linker-plugin" ) ;
94
+ context. add_driver_option ( "-fno-use-linker-plugin" ) ;
90
95
context. add_command_line_option ( "-ffat-lto-objects" ) ;
91
96
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
92
97
context. compile_to_file (
@@ -175,7 +180,8 @@ pub(crate) unsafe fn codegen(
175
180
context. add_command_line_option ( "-flto=auto" ) ;
176
181
context. add_command_line_option ( "-flto-partition=one" ) ;
177
182
//context.add_command_line_option("-ffat-lto-objects");
178
- //context.add_command_line_option("-fno-use-linker-plugin");
183
+ context. add_command_line_option ( "-fno-use-linker-plugin" ) ;
184
+ context. add_driver_option ( "-fno-use-linker-plugin" ) ;
179
185
180
186
// FIXME FIXME FIXME:
181
187
// /usr/bin/ld: warning: incremental linking of LTO and non-LTO objects; using -flinker-output=nolto-rel which will bypass whole program optimization
@@ -215,6 +221,8 @@ pub(crate) unsafe fn codegen(
215
221
println ! ( "****************************************************************************************************" ) ;
216
222
217
223
let context = Context :: default ( ) ;
224
+ context. add_command_line_option ( "-fno-use-linker-plugin" ) ;
225
+ context. add_driver_option ( "-fno-use-linker-plugin" ) ;
218
226
if cgcx. target_arch == "x86" || cgcx. target_arch == "x86_64" {
219
227
// NOTE: it seems we need to use add_driver_option instead of
220
228
// add_command_line_option here because we use the LTO frontend via gcc.
0 commit comments