I'm using Eclipse CDT 9 Neon with GCC 6.3 on Windows 7 for a STM32 project.
I have installed the GNU ARM Plug-in and use sh.exe for long command line management (cmd.exe from windows have a limite of 8192 char) for calling make.exe (GNU Coreutils date: 04.06.2009).
I'm working on a big project.
Without build exclusion my linker command line is over 33 000 char and generate an error on the linker command line.
With builds exclusions and a reduced version of my project, I have reduce the linker command line to 15 600 char, compilation worked fine and my binary file is operational.
At first, for the full version of my project, the linker command line is bigger than 20 000 char and generate an ACCESS VIOLATION on sh.exe.
With an other version of sh.exe (from Microsemi IDE) I have no more ACCESS VIOLATION on sh.exe and be able to link more file.
But for the full version of my project I have a link error : make (e=87): Paramètre incorrect.This error come from a to long command line (more than 32 000 char).
Other IDE (Winidea with GCC) use an argument file that combine linker file (.ld) and the obj files list to have a very short linker command line.
How can I configure GCC in Eclipse to use an argument file for the linker ?
I found a solution, not perfect but fully operational. I have writen an bat file to generate obj listing file.Instructions to use it are in rem.
I have writen the file "gen__link_ld.bat" :
echo offrem ***************************************************************************rem Generate script file for the linker to go throuth linker command line toorem long trouble under windows (32 000 char max)rem ***************************************************************************rem Lunch in pre-build step is not advised, this commande is run in paralelrem with build step that can temporarie supress obj file need to run rem compilation a 2nd time to have a script file up to date for the linker.rem Run in pre-build step generate trouble in debug mode.remrem Use manual lunch with 2 parameters :rem create a .bat file per build with the folowing commande :rem gen__link_ld.bat ./project relative path and .ld file name ./project relative build pathrem in linker commande line pattern replace {INPUT}rem by -Xlinker --script=${ProjDirPath}/${ConfigName}/___link.ldrem and add manualy librairie after ___link.ld, in this case library includerem throuth graphical build setting don't work, they may use {INPUT} from therem standard commanderem ***************************************************************************echo **************************************************************************echo ***************************** *****************************echo ***************************** WARNING *****************************echo ***************************** *****************************echo **************************************************************************echo Generate script file for the linker to go throuth linker command line tooecho long trouble under windows (32 000 char max)echo echo List only existing obj file.echo The best way is to use manual lunch with one .bat file per build.echo follow information in r e m above to use it.echoecho Run this commande evry time that obj liste is modified.echo WARNING this function don't delete obj file for file recently excludeecho frome build.echo To secure the compilation need a clean to suppress all obj, run a first echo build witch compile all file without error (with only linker error) toecho generate an obj file listing up to date and run a second buid for a echo successful linker step. When the OJB file listing is up to date, only echo eclipse build commande is neededecho **************************************************************************echo Linker file use : %1echo Build path use : %2echo **************************************************************************setlocal ENABLEDELAYEDEXPANSIONset destination=%2set destination=%destination:/=\%rem *** Generate obj file listing ***echo INPUT(>%destination%\___link.lddir %destination%\*.o /s /b >>%destination%\___link.ldecho )>>%destination%\___link.ldrem *** Concatenat obj file listing with ld file from parameter 1 ***set str=%1set str=%str:/=\%type %str%>>%destination%\___link.ldecho *** OBJ file listing up to dateecho **************************************************************************pause
Thanks