0

I've repeated a plain (i.e. Default) cygwin 64bit installation with setup-x86_64.exe under the same windows 7 64bit machine and every time cygwin creates different cyg*.dll under bin.

The created files have the same size and modification date. But their checksums differ (here the md5sums of bin/cygz.dll):

$ md5sum /cygdrive/w/cygwin1/bin/cygz.dll
c285271b9c04760e6041f56d8cad66de */cygdrive/w/cygwin1/bin/cygz.dll

$ md5sum /cygdrive/w/cygwin2/bin/cygz.dll
03e3384036922ceaa2a560ae9c584e6f */cygdrive/w/cygwin2/bin/cygz.dll

and their contents differ too (here xxd of bin/cygz.dll:

$ xxd -s 128 -l 16 /cygdrive/w/cygwin1/bin/cygz.dll
00000080: 5045 0000 6486 0c00 b144 d85b 004c 0100  PE..d....D.[.L..
                              ^^^^

$ xxd -s 128 -l 16 /cygdrive/w/cygwin2/bin/cygz.dll
00000080: 5045 0000 6486 0c00 b946 d85b 004c 0100  PE..d....F.[.L..
                              ^^^^
wolfrevo
  • 6,651
  • 2
  • 26
  • 38

1 Answers1

2

The checksum are different as dll's need to be loaded at different address from each other to avoid collision during fork.
The loading addresses are different from those written in the dll's at build time.
You can see the loading address with rebase

$ rebase -si | head -n 5
/usr/libexec/coreutils/libstdbuf.so  base 0x0003781a0000 size 0x0000c000
/usr/lib/zsh/5.5.1/zsh/zutil.dll     base 0x0003781b0000 size 0x0000f000
/usr/lib/zsh/5.5.1/zsh/zselect.dll   base 0x0003781c0000 size 0x0000b000
/usr/lib/zsh/5.5.1/zsh/zpty.dll      base 0x0003781d0000 size 0x0000c000
/usr/lib/zsh/5.5.1/zsh/zprof.dll     base 0x0003781e0000 size 0x0000c000
 $ rebase -si | tail -n 5
/usr/bin/cyg4ti2util-0.dll           base 0x0003ffe70000 size 0x00018000
/usr/bin/cyg4ti2int64-0.dll          base 0x0003ffe90000 size 0x00068000
/usr/bin/cyg4ti2int32-0.dll          base 0x0003fff00000 size 0x00069000
/usr/bin/cyg4ti2gmp-0.dll            base 0x0003fff70000 size 0x00076000
/usr/bin/cyg4ti2common-0.dll         base 0x0003ffff0000 size 0x0000c000

the assignment of loading address at each dll's is performed by the script

/etc/postinstall/0p_000_autorebase.dash

that is executed by Cywin setup after every installation/update.

matzeri
  • 8,062
  • 2
  • 15
  • 16
  • thanks for your answer which leads me to this explanation of cygwin's rebase: https://stackoverflow.com/a/33138632/1659599 – wolfrevo Oct 30 '18 at 17:43