can hutch or anyone who fully understood what MERGE is explain to me what it does???
Posted on 2001-06-25 18:24:00 by disease_2000
disease, The use of MERGE is a linker option in 32 bit files that is related to the structure of PE files. The file type is made up of section (not segments like in DOS) that perform different functions in the assembled program. Code is store in one or more section, data is stored in another, resource information is stored in another etc ... The /MERGE option allows you to combine 2 sections which often results in a smaller EXE file. The following LINK line shows how it works, it combines the ".text" section with the ".rdata" section.

\masm32\bin\Link /SUBSYSTEM:WINDOWS /MERGE:.rdata=.text asmfile.obj
It is worth noting that the section names are not important as they are not used by the loader in the operating system, the address of each section is in the PE header and it from here that the operating system finds the parts of the EXE file as it loads. The main use I have found for the option is with very small files that are too small to compress with programs like UPX, PECOMPACT etc ... You can get a section size reduction (512 bytes) most times when you merge the sections on a very small file. On larger files that you wish to compress with programs of this type, the compressors usually merge the sections to get the file size down so there is no real point using the /MERGE option when you are going to compress and EXE file. From MSDN ~~~~~~~~~ /MERGE:from=to This option combines the first section (from) with the second section (to), naming the resulting section to. If the second section does not exist, LINK renames the section from as to. The /MERGE option is useful for creating VxDs and overriding the compiler-generated section names. Regards, hutch@pbq.com.au
Posted on 2001-06-25 18:46:00 by hutch--
sorry for the interruption. hutch--, based on what you said, /MERGE:from=to only works with two section? what if i want to merge data into rdata and then in both of them into .text? Hiroshimator: can you delete my old account? (Royal Flush)
Posted on 2001-06-25 20:09:00 by +Royal Flush+
LINK  example /out:exampleA.exe /filealign:512 /IGNORE:4078,4060 /nologo /SUBSYSTEM:WINDOWS /optidata /SECTION:.text,EWR /MERGE:.rdata=.text /MERGE:.data=.text
Here is an example of merging two sections into the
.text
section. :)
Posted on 2001-06-25 20:31:00 by bitRAKE
thanx for the reply hutch. Rake, where did you get info for those command? (don't tell me it's from masm6.15 reference manual)
Posted on 2001-06-25 22:39:00 by disease_2000
www.Elicz.com I've spent days there and in his code.
Posted on 2001-06-25 23:23:00 by bitRAKE
Funny this post comes up. I've spent the last couple of days playing with the various linker options, including the /merge function, and I got a lot of examples of their usage from Elicz's code as well. I found one ref that has some good info for Masm 6.1 on Command-Line Options, Directives, Symbols and Operators, and Error Messages that looks pretty useful. http://www.cs.wayne.edu/labPages/masmref.htm Kayaker
Posted on 2001-06-26 01:26:00 by Kayaker
thanx for the link Rake (rickey?) :) by the way, Kayaker, how come on the RCE there's 3 stars next to my name?
Posted on 2001-06-26 16:10:00 by disease_2000