Enabling Link-Time Optimization - Keil

文章推薦指數: 80 %
投票人數:10人

You must enable Link-Time Optimization (LTO) in both armclang and armlink . To enable LTO: At compilation time, use the armclang option -flto to produce ELF ... Products Download Events Support Videos  AllProductFamiliesARM7,ARM9,andCortex-M3ProductsC16x,XC16x,andST10ProductsC251and80C251ProductsCx51and8051ProductsModifiedAnytimeIntheLast7DaysIntheLast14DaysIntheLast30DaysIntheLast90DaysIntheLast6Months TechnicalSupport Overview Search Contact AssistanceRequest Feedback On-LineManuals ProductManuals DocumentConventions CompilerGettingStartedGuide Preface GettingStarted GettingStartedwiththeSVEfeaturesinArmCompi UsingCommonCompilerOptions WritingOptimizedCode Effectofthevolatilekeywordoncompileroptimiz Optimizingloops Inliningfunctions StackuseinCandC++ Packingdatastructures Optimizingforcodesizeorperformance Methodsofminimizingfunctionparameterpassingo OptimizingacrossmoduleswithLink-TimeOptimizat EnablingLink-TimeOptimization RestrictionswithLink-TimeOptimization Removingunusedcodeacrossmultipleobjectfiles ScatterfilesectionorobjectplacementwithLink Howoptimizationaffectsthedebugexperience AssemblingAssemblyCode UsingAssemblyandIntrinsicsinCorC++Code SVECodingConsiderationswithArmCompiler MappingCodeandDatatotheTarget Overlays EmbeddedSoftwareDevelopment BuildingSecureandNon-secureImagesUsingArmv8‑ OverviewoftheLinker GettingImageDetails SysVDynamicLinking OverviewofthefromelfImageConverter Usingfromelf OverviewoftheArmLibrarian OverviewofthearmasmLegacyAssembler Supportingreferenceinformation ArmCompilerUserGuideChanges Home  /  CompilerGettingStartedGuideVersion6.16 EnablingLink-TimeOptimization Non-Confidential PDFversion100748_0616_01_enArm®CompilerUserGuideVersion6.16Home >WritingOptimizedCode >OptimizingacrossmoduleswithLink-TimeOptimization >EnablingLink-TimeOptimization4.8.1EnablingLink-TimeOptimization YoumustenableLink-TimeOptimization(LTO)inbotharmclangandarmlink. ToenableLTO: Atcompilationtime,usethearmclangoption-fltotoproduceELFfilessuitableforLTO.TheseELFfilescontainbitcodeina.llvmbcsection. Note:Thearmclangoption-Omaxautomaticallyenablesthe-fltooption. Atlinktime,usethearmlinkoption--ltotoenableLTOforthespecifiedbitcodefiles. Note:Ifyouusethe-fltooptionwithoutthe-coption,armclangautomatically passesthe--ltooptiontoarmlink. Example1:Optimizingallsourcefiles ThefollowingexampleperformsLTOacrossallsourcefiles: armclang--target=arm-arm-none-eabi-march=armv8-a-fltosrc1.csrc2.csrc3.c-ooutput.axf Thisexampledoesthefollowing: armclangcompilestheCsourcefilessrc1.c,src2.c,andsrc3.ctotheELFfilessrc1.o,src2.o,andsrc3.o.TheseELFfilescontainbitcode,andthereforefromelfcannotdisassemblethem. armclangautomaticallyinvokes armlinkwiththe--ltooption. armlinkpassesthebitcodefilessrc1.o,src2.o,andsrc3.otothelink-timeoptimizertoproduceasingleoptimizedELFobjectfile. armlinkcreatestheexecutable output.axffromtheELFobjectfile. Note:Inthisexample,asarmclangautomaticallycallsarmlink,thelink-timeoptimizerhasthesameoptimizationlevelasarmclang.Asnooptimizationlevelisspecifiedforarmclang,itisthedefaultoptimizationlevel-O0,and--lto_level=O0. Example2:Optimizingasubsetofsourcefiles ThefollowingexampleperformsLTOforasubsetofsourcefiles. armclang--target=arm-arm-none-eabi-march=armv8-a-csrc1.c-osrc1.o armclang--target=arm-arm-none-eabi-march=armv8-a-c-fltosrc2.c-osrc2.o armclang--target=arm-arm-none-eabi-march=armv8-a-c-fltosrc3.c-osrc3.o armlink--ltosrc1.osrc2.osrc3.o-ooutput.axf Thisexampledoesthefollowing: armclangcompilestheCsource filesrc1.ctotheELFobjectfilesrc1.o. armclangcompilestheCsource filessrc2.candsrc3.ctotheELFfilessrc2.o andsrc3.o.TheseELFfilescontain bitcode. armlinkpassesthebitcodefilessrc2.oandsrc3.otothelink-timeoptimizertoproduceasingleoptimizedELFobjectfile. armlinkcombinestheELFobjectfilesrc1.owiththeobjectfilethatthelink-timeoptimizerproducestocreatetheexecutableoutput.axf. Note:Inthisexample,becausearmclangandarmlinkarecalledseparately,theyhaveindependentoptimizationlevels.Asnooptimizationlevelisspecifiedforarmclangorarmlink,armclanghasthedefaultoptimizationlevel-O0andthelink-timeoptimizerhasthedefaultoptimizationlevel--lto_level=O2.Youcancallarmclangandarmlinkwithanycombinationofoptimizationlevels. Non-Confidential PDFversion100748_0616_01_enCopyright©2016–2021ArmLimitedoritsaffiliates.Allrightsreserved. Home >WritingOptimizedCode >OptimizingacrossmoduleswithLink-TimeOptimization >EnablingLink-TimeOptimization Products DevelopmentTools Arm C166 C51 C251 µVisionIDEandDebugger   Hardware&Collateral ULINKDebugAdaptors EvaluationBoards ProductBrochures DeviceDatabase Distributors Downloads MDK-Arm C51 C166 C251 Filedownloads Support Knowledgebase DiscussionForum ProductManuals ApplicationNotes Contact Distributors RequestaQuote SalesContacts   CookieSettings|TermsofUse|Privacy|Accessibility|Trademarks|ContactUs|Feedback Copyright©2005-2019ArmLimited(oritsaffiliates).Allrightsreserved. Importantinformation Thissiteusescookiestostoreinformationonyourcomputer.Bycontinuingtouseoursite,youconsenttoourcookies. Don'tshowthismessageagain ChangeSettings PrivacyPolicyUpdate Arm’sPrivacyPolicyhasbeenupdated.Bycontinuingtouseoursite,youconsenttoArm’sPrivacyPolicy.PleasereviewourPrivacyPolicytolearnmoreaboutourcollection,useandtransfersofyourdata. Acceptandhidethismessage /support/man/docs/armclang_intro/armclang_intro_chr1413451155715.asp



請為這篇文章評分?