-1

Does the order of options for linker make difference in the .map file or not ?

I have software and I compiled it with options for linker and I built code

then I changed the order of the option for the linker and make build a gain for the code

but in the two cases the generated .map file are the different but has the same size

why ????

1 Answers1

0

I am not sure which compiler and linker are you using. I assume it is gcc.

The order of different, unrelated, options will probably make no change to the object or any other output. but if there is any dependency between the options, the order might change the context.

from man ld: Some of the command-line options to ld may be specified at any point in the command line. However, options which refer to files, such as -l or -T, cause the file to be read at the point at which the option appears in the command line, relative to the object files and other file options. Repeating non-file options with a different argument will either have no further effect, or override prior occurrences (those further to the left on the command line) of that option. Options which may be meaningfully specified more than once are noted in the descriptions below.

eyalm
  • 3,366
  • 19
  • 21
  • I am using IAR compiler and linker – Muhammed S. ELtahan Jun 08 '16 at 18:31
  • -f "${workspace_loc:/${ProjName}/Path for the linker file}" -cM16C -J2,sum,1,,,1,,1=_APPL_CK_ROM_BEGIN-_APPL_CK_ROM_END;_APPLH_CK_ROM_BEGIN-_APPLH_CK_ROM_END -HFFFF -l $(basename $@).map -xeimnso -rt -Oieee695,lbm=$(basename $@).695 -Oelf,spc=$(basename $@).elf ======================================================== -cM16C -HFFFF -xeimnso -J2,sum,1,,,1,,1=_APPL_CK_ROM_BEGIN-_APPL_CK_ROM_END;_APPLH_CK_ROM_BEGIN-_APPLH_CK_ROM_END -rt -l $(OUTFILE).map -I.\$(OBJDIR) -I.\$(LNKDIR) \ -Omotorola-s28=$(OUTFILE).s28 \ -Oieee695,lbm=$(OUTFILE).695 \ -Oelf,spc=$(OUTFILE).elf – Muhammed S. ELtahan Jun 08 '16 at 18:33
  • @MuhammedS.ELtahan Please don't dump that much data on comments, it is unreadable. Edit your question and include all necessary information there. – user694733 Jun 09 '16 at 07:30