From dfd0b22ce637b416d32b372bc8aff89a41fe81f2 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 28 Jul 2016 13:21:47 +0200 Subject: [PATCH] Disable STV on x86 platforms for the Quex lexer This limits the memory usage peak of GCC 6 based compilers and should prevent OOM on these platforms. Change-Id: If727882e05d1fb9881d1ba7c98aa9facb991c2b2 TN: P726-024 --- langkit/templates/project_file.mako | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/langkit/templates/project_file.mako b/langkit/templates/project_file.mako index 630de8739..d37b99775 100644 --- a/langkit/templates/project_file.mako +++ b/langkit/templates/project_file.mako @@ -90,6 +90,8 @@ library project ${lib_name} is for Object_Dir use "../../obj/${lib_name.lower()}/" & Library_Kind_Param; + Target := Libadalang'Target; + package Compiler is Common_Ada_Cargs := (); @@ -132,12 +134,20 @@ library project ${lib_name} is -- profiling, for instance. for Default_Switches ("Ada") use ("-g", "-Ofast", "-gnatp") & Common_Ada_Cargs; - for Default_Switches ("C") use Common_C_Cargs - & ("-Ofast", "-fno-ree", "-fdisable-rtl-cprop_hardreg", - "-fdisable-rtl-sched2"); - -- Deactivate because of memory usage, see P726-024. This limits - -- the memory usage peaks of GCC 6 based compilers and should - -- prevent OOM on 32-bit platforms. + + for Default_Switches ("C") use Common_C_Cargs & ("-Ofast"); + + case Target is + when "x86-linux" | "x86-windows" => + for Switches ("quex_lexer.c") use Common_C_Cargs + & ("-Ofast", "-fno-ree", "-fdisable-rtl-cprop_hardreg", + "-fdisable-rtl-sched2", "-mno-stv"); + -- Deactivate because of memory usage, see P726-024. This + -- limits the memory usage peaks of GCC 6 based compilers + -- and should prevent OOM on 32-bit platforms. + when others => + null; + end case; end case; end Compiler;