* i686-w64-mingw32-gcc -fstack-protector-strong
@ 2017-09-08 14:15 Lee
2017-09-08 15:04 ` Marco Atzeri
2017-09-08 23:01 ` Steven Penny
0 siblings, 2 replies; 13+ messages in thread
From: Lee @ 2017-09-08 14:15 UTC (permalink / raw)
To: cygwin
I'm hoping that I'm just missing a library, but which one? Even
better, how to tell which one?
$ i686-w64-mingw32-gcc -o div.exe div.c
$ ./div
works
$ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
$ ./div
C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
cannot open shared object file: No such file or directory
$ ldd div.exe
ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffef5c50000)
??? => ??? (0x778f0000)
wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000)
wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll (0x50dd0000)
$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thanks
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 14:15 i686-w64-mingw32-gcc -fstack-protector-strong Lee
@ 2017-09-08 15:04 ` Marco Atzeri
2017-09-08 18:53 ` Lee
2017-09-08 23:01 ` Steven Penny
1 sibling, 1 reply; 13+ messages in thread
From: Marco Atzeri @ 2017-09-08 15:04 UTC (permalink / raw)
To: cygwin
On 08/09/2017 16:14, Lee wrote:
> I'm hoping that I'm just missing a library, but which one? Even
> better, how to tell which one?
>
> $ i686-w64-mingw32-gcc -o div.exe div.c
> $ ./div
> works
>
> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
> $ ./div
> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
> cannot open shared object file: No such file or directory
>
> $ ldd div.exe
> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffef5c50000)
> ??? => ??? (0x778f0000)
> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000)
> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll (0x50dd0000)
>
try
cygcheck ./div.exe
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 15:04 ` Marco Atzeri
@ 2017-09-08 18:53 ` Lee
2017-09-08 19:25 ` Marco Atzeri
2017-09-08 21:09 ` Nellis, Kenneth
0 siblings, 2 replies; 13+ messages in thread
From: Lee @ 2017-09-08 18:53 UTC (permalink / raw)
To: cygwin
On 9/8/17, Marco Atzeri wrote:
> On 08/09/2017 16:14, Lee wrote:
>> I'm hoping that I'm just missing a library, but which one? Even
>> better, how to tell which one?
>>
>> $ i686-w64-mingw32-gcc -o div.exe div.c
>> $ ./div
>> works
>>
>> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
>> $ ./div
>> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
>> cannot open shared object file: No such file or directory
>>
>> $ ldd div.exe
>> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll
>> (0x7ffef5c50000)
>> ??? => ??? (0x778f0000)
>> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000)
>> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll
>> (0x50dd0000)
>>
>
> try
> cygcheck ./div.exe
nothing useful for a non-cygwin program?
$ cygcheck ./div.exe
C:\cygwin\home\Lee\t\div.exe
vs. built using cygwin:
$ gcc -fstack-protector-strong -o div.exe div.c
$ ./div
works
$ cygcheck ./div.exe
C:\cygwin\home\Lee\t\div.exe
C:\cygwin\bin\cygwin1.dll
C:\WINDOWS\system32\KERNEL32.dll
C:\WINDOWS\system32\ntdll.dll
C:\WINDOWS\system32\KERNELBASE.dll
C:\cygwin\bin\cygssp-0.dll
Was there ever a man page for cygcheck? I remember looking at one,
but maybe I it was https://cygwin.com/cygwin-ug-net/cygcheck.html ??
$ man cygcheck
No manual entry for cygcheck
$ info cygcheck
info: No menu item 'cygcheck' in node '(dir)Top'
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 18:53 ` Lee
@ 2017-09-08 19:25 ` Marco Atzeri
2017-09-08 20:01 ` Lee
2017-09-08 21:09 ` Nellis, Kenneth
1 sibling, 1 reply; 13+ messages in thread
From: Marco Atzeri @ 2017-09-08 19:25 UTC (permalink / raw)
To: cygwin
On 08/09/2017 20:53, Lee wrote:
> On 9/8/17, Marco Atzeri wrote:
>> On 08/09/2017 16:14, Lee wrote:
>>> I'm hoping that I'm just missing a library, but which one? Even
>>> better, how to tell which one?
>>>
>>> $ i686-w64-mingw32-gcc -o div.exe div.c
>>> $ ./div
>>> works
>>>
>>> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
>>> $ ./div
>>> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
>>> cannot open shared object file: No such file or directory
>>>
>>> $ ldd div.exe
>>> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll
>>> (0x7ffef5c50000)
>>> ??? => ??? (0x778f0000)
>>> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000)
>>> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll
>>> (0x50dd0000)
>>>
>>
>> try
>> cygcheck ./div.exe
>
> nothing useful for a non-cygwin program?
> $ cygcheck ./div.exe
> C:\cygwin\home\Lee\t\div.exe
cygcheck works also for not cygwin program
( cygcheck --help for details)
cd /cygdrive/c/windows/system32
$ cygcheck ./net.exe
C:\windows\system32\net.exe
C:\windows\system32\ADVAPI32.dll
C:\windows\system32\msvcrt.dll
C:\windows\system32\KERNELBASE.dll
C:\windows\system32\ntdll.dll
[long cut]
C:\windows\system32\samcli.dll
C:\windows\system32\srvcli.dll
C:\windows\system32\wkscli.dll
C:\windows\system32\MPR.dll
C:\windows\system32\IPHLPAPI.DLL
C:\windows\system32\NSI.dll
C:\windows\system32\WINNSI.DLL
You can also use
$ objdump -x ./net.exe |grep -i "dll name"
DLL Name: ADVAPI32.dll
DLL Name: KERNEL32.dll
DLL Name: msvcrt.dll
DLL Name: ntdll.dll
DLL Name: netutils.dll
DLL Name: browcli.dll
DLL Name: samcli.dll
DLL Name: srvcli.dll
DLL Name: wkscli.dll
DLL Name: MPR.dll
DLL Name: IPHLPAPI.DLL
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 19:25 ` Marco Atzeri
@ 2017-09-08 20:01 ` Lee
2017-09-08 20:10 ` Marco Atzeri
0 siblings, 1 reply; 13+ messages in thread
From: Lee @ 2017-09-08 20:01 UTC (permalink / raw)
To: cygwin
On 9/8/17, Marco Atzeri wrote:
> On 08/09/2017 20:53, Lee wrote:
>> On 9/8/17, Marco Atzeri wrote:
>>> On 08/09/2017 16:14, Lee wrote:
>>>> I'm hoping that I'm just missing a library, but which one? Even
>>>> better, how to tell which one?
>>>>
>>>> $ i686-w64-mingw32-gcc -o div.exe div.c
>>>> $ ./div
>>>> works
>>>>
>>>> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
>>>> $ ./div
>>>> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
>>>> cannot open shared object file: No such file or directory
>>>>
>>>> $ ldd div.exe
>>>> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll
>>>> (0x7ffef5c50000)
>>>> ??? => ??? (0x778f0000)
>>>> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll
>>>> (0x50e50000)
>>>> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll
>>>> (0x50dd0000)
>>>>
>>>
>>> try
>>> cygcheck ./div.exe
>>
>> nothing useful for a non-cygwin program?
>> $ cygcheck ./div.exe
>> C:\cygwin\home\Lee\t\div.exe
>
> cygcheck works also for not cygwin program
> ( cygcheck --help for details)
<.. snip examples ..>
> You can also use
>
> $ objdump -x ./net.exe |grep -i "dll name"
<.. snip output..>
that's interesting
I've still got the 'i686-w64-mingw32-gcc -fstack-protector-strong' executable:
$ ./div.exe
C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
cannot open shared object file: No such file or directory
$ objdump -x ./div.exe | egrep -i "dll name"
DLL Name: KERNEL32.dll
DLL Name: msvcrt.dll
DLL Name: libssp-0.dll
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssp&arch=x86_64
shows libssp0 as the GCC Stack-Smashing Protection runtime library
but I don't see anything like that with a leading "mingw64-i686-"
name, so I'm out of luck?
Thanks,
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 20:01 ` Lee
@ 2017-09-08 20:10 ` Marco Atzeri
2017-09-08 21:08 ` Lee
0 siblings, 1 reply; 13+ messages in thread
From: Marco Atzeri @ 2017-09-08 20:10 UTC (permalink / raw)
To: cygwin
On 08/09/2017 22:01, Lee wrote:
> On 9/8/17, Marco Atzeri wrote:
>> On 08/09/2017 20:53, Lee wrote:
>>> On 9/8/17, Marco Atzeri wrote:
>>>> On 08/09/2017 16:14, Lee wrote:
> I've still got the 'i686-w64-mingw32-gcc -fstack-protector-strong' executable:
> $ ./div.exe
> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
> cannot open shared object file: No such file or directory
>
> $ objdump -x ./div.exe | egrep -i "dll name"
> DLL Name: KERNEL32.dll
> DLL Name: msvcrt.dll
> DLL Name: libssp-0.dll
>
> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssp&arch=x86_64
> shows libssp0 as the GCC Stack-Smashing Protection runtime library
> but I don't see anything like that with a leading "mingw64-i686-"
> name, so I'm out of luck?
>
https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fmingw64-i686-gcc-core%2Fmingw64-i686-gcc-core-6.3.0-1&grep=libssp-0.dll
almost at the end:
usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 20:10 ` Marco Atzeri
@ 2017-09-08 21:08 ` Lee
2017-09-08 22:34 ` Yaakov Selkowitz
0 siblings, 1 reply; 13+ messages in thread
From: Lee @ 2017-09-08 21:08 UTC (permalink / raw)
To: cygwin
On 9/8/17, Marco Atzeri wrote:
> On 08/09/2017 22:01, Lee wrote:
>> On 9/8/17, Marco Atzeri wrote:
>>> On 08/09/2017 20:53, Lee wrote:
>>>> On 9/8/17, Marco Atzeri wrote:
>>>>> On 08/09/2017 16:14, Lee wrote:
>> I've still got the 'i686-w64-mingw32-gcc -fstack-protector-strong'
>> executable:
>> $ ./div.exe
>> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
>> cannot open shared object file: No such file or directory
>>
>> $ objdump -x ./div.exe | egrep -i "dll name"
>> DLL Name: KERNEL32.dll
>> DLL Name: msvcrt.dll
>> DLL Name: libssp-0.dll
>>
>> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssp&arch=x86_64
>> shows libssp0 as the GCC Stack-Smashing Protection runtime library
>> but I don't see anything like that with a leading "mingw64-i686-"
>> name, so I'm out of luck?
>>
>
>
> https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fmingw64-i686-gcc-core%2Fmingw64-i686-gcc-core-6.3.0-1&grep=libssp-0.dll
>
> almost at the end:
>
> usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
I already have that
$ ls -l /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
-rwxr-xr-x 1 root None 14336 Feb 22 2017
/usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
But run setup, nothing shows as pending, switch to full view, find the
line & clicking on the version cycles thru Keep -> Reinstall ->
6.3.0-1 -> Uninstall -> 5.4.0-3 -> Keep
Upgrading to 6.3.0-1 doesn't change anything:
$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
$ ./div.exe
C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
cannot open shared object file: No such file or directory
$ objdump -x ./div.exe | egrep -i "dll name"
DLL Name: KERNEL32.dll
DLL Name: msvcrt.dll
DLL Name: libssp-0.dll
$ ls -l /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
-rwxr-xr-x 1 root None 14336 Aug 17 08:26
/usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
$
Thanks,
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 18:53 ` Lee
2017-09-08 19:25 ` Marco Atzeri
@ 2017-09-08 21:09 ` Nellis, Kenneth
2017-09-08 21:42 ` Lee
1 sibling, 1 reply; 13+ messages in thread
From: Nellis, Kenneth @ 2017-09-08 21:09 UTC (permalink / raw)
To: cygwin
> From: Lee
> ...
> Was there ever a man page for cygcheck? I remember looking at one,
> but maybe I it was https://cygwin.com/cygwin-ug-net/cygcheck.html ??
> $ man cygcheck
> No manual entry for cygcheck
>
> $ info cygcheck
> info: No menu item 'cygcheck' in node '(dir)Top'
Both man and info work for me:
$ man cygcheck | head
CYGCHECK(1) Cygwin Utilities CYGCHECK(1)
NAME
cygcheck - List system information, check installed packages, or query package database
SYNOPSIS
cygcheck [-v] [-h] PROGRAM
cygcheck -c [-d] [PACKAGE]
cygcheck -s [-r] [-v] [-h]
cygcheck -k
$ info cygcheck | head
info: No menu item 'cygcheck' in node '(dir)Top'
CYGCHECK(1) Cygwin Utilities CYGCHECK(1)
NAME
cygcheck - List system information, check installed packages, or query package database
SYNOPSIS
cygcheck [-v] [-h] PROGRAM
cygcheck -c [-d] [PACKAGE]
cygcheck -s [-r] [-v] [-h]
cygcheck -k
$
--Ken Nellis
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 21:09 ` Nellis, Kenneth
@ 2017-09-08 21:42 ` Lee
0 siblings, 0 replies; 13+ messages in thread
From: Lee @ 2017-09-08 21:42 UTC (permalink / raw)
To: cygwin
On 9/8/17, Nellis, Kenneth wrote:
>> From: Lee
>> ...
>> Was there ever a man page for cygcheck? I remember looking at one,
>> but maybe I it was https://cygwin.com/cygwin-ug-net/cygcheck.html ??
>> $ man cygcheck
>> No manual entry for cygcheck
>>
>> $ info cygcheck
>> info: No menu item 'cygcheck' in node '(dir)Top'
>
> Both man and info work for me:
Thanks. I was missing the cygwin-doc package :(
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 21:08 ` Lee
@ 2017-09-08 22:34 ` Yaakov Selkowitz
2017-09-08 23:10 ` Lee
0 siblings, 1 reply; 13+ messages in thread
From: Yaakov Selkowitz @ 2017-09-08 22:34 UTC (permalink / raw)
To: cygwin
[-- Attachment #1.1: Type: text/plain, Size: 1180 bytes --]
On 2017-09-08 16:08, Lee wrote:
> $ i686-w64-mingw32-gcc --version
> i686-w64-mingw32-gcc (GCC) 6.3.0
> Copyright (C) 2016 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
> $ ./div.exe
> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
> cannot open shared object file: No such file or directory
> $ objdump -x ./div.exe | egrep -i "dll name"
> DLL Name: KERNEL32.dll
> DLL Name: msvcrt.dll
> DLL Name: libssp-0.dll
> $ ls -l /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
> -rwxr-xr-x 1 root None 14336 Aug 17 08:26
> /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
You created a MinGW executable which depends on other MinGW DLLs.
Therefore, either you have to tell it where to find its dependencies:
PATH="$(cygpath -S):$(cygpath
-W):/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH" \
./div.exe
Or, since you're only using GCC's libraries, just link with -static.
--
Yaakov
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 14:15 i686-w64-mingw32-gcc -fstack-protector-strong Lee
2017-09-08 15:04 ` Marco Atzeri
@ 2017-09-08 23:01 ` Steven Penny
2017-09-08 23:22 ` Lee
1 sibling, 1 reply; 13+ messages in thread
From: Steven Penny @ 2017-09-08 23:01 UTC (permalink / raw)
To: cygwin
On Fri, 8 Sep 2017 10:14:54, Lee wrote:
> $ i686-w64-mingw32-gcc -o div.exe div.c
> $ ./div
> works
>
> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
> $ ./div
> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
> cannot open shared object file: No such file or directory
>
> $ ldd div.exe
> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffef5c50000)
> ??? => ??? (0x778f0000)
> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000)
> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll (0x50dd0000)
>
> $ i686-w64-mingw32-gcc --version
> i686-w64-mingw32-gcc (GCC) 5.4.0
You need to paste or link to div.c, otherwise this seems a pointless exercise.
See, I cannot repro:
$ cat div.c
#include <stdio.h>
int main() {
puts("hello world");
}
$ x86_64-w64-mingw32-gcc -o div div.c
$ ./div
hello world
$ x86_64-w64-mingw32-gcc -fstack-protector-strong -o div div.c
$ ./div
hello world
$ ldd div
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x773a0000)
kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x77180000)
KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x7fefd1a0000)
msvcrt.dll => /cygdrive/c/Windows/system32/msvcrt.dll (0x7fefde00000)
$ x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 5.4.0
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 22:34 ` Yaakov Selkowitz
@ 2017-09-08 23:10 ` Lee
0 siblings, 0 replies; 13+ messages in thread
From: Lee @ 2017-09-08 23:10 UTC (permalink / raw)
To: cygwin
On 9/8/17, Yaakov Selkowitz <yselkowitz@cygwin.com> wrote:
> On 2017-09-08 16:08, Lee wrote:
>> $ i686-w64-mingw32-gcc --version
>> i686-w64-mingw32-gcc (GCC) 6.3.0
>> Copyright (C) 2016 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions. There is
>> NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>> PURPOSE.
>>
>> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
>> $ ./div.exe
>> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
>> cannot open shared object file: No such file or directory
>> $ objdump -x ./div.exe | egrep -i "dll name"
>> DLL Name: KERNEL32.dll
>> DLL Name: msvcrt.dll
>> DLL Name: libssp-0.dll
>> $ ls -l /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
>> -rwxr-xr-x 1 root None 14336 Aug 17 08:26
>> /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
>
> You created a MinGW executable which depends on other MinGW DLLs.
> Therefore, either you have to tell it where to find its dependencies:
>
> PATH="$(cygpath -S):$(cygpath
> -W):/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH" \
> ./div.exe
>
> Or, since you're only using GCC's libraries, just link with -static.
That was it. Thank you!!
$ i686-w64-mingw32-gcc -static -fstack-protector-strong -o div.exe div.c
$ ./div
works
$ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
$ PATH=/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH ./div.exe
works
and follow up question if I may - what should I have read that would
have told me that?
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: i686-w64-mingw32-gcc -fstack-protector-strong
2017-09-08 23:01 ` Steven Penny
@ 2017-09-08 23:22 ` Lee
0 siblings, 0 replies; 13+ messages in thread
From: Lee @ 2017-09-08 23:22 UTC (permalink / raw)
To: cygwin
On 9/8/17, Steven Penny <svnpenn@gmail.com> wrote:
> On Fri, 8 Sep 2017 10:14:54, Lee wrote:
>> $ i686-w64-mingw32-gcc -o div.exe div.c
>> $ ./div
>> works
>>
>> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
>> $ ./div
>> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
>> cannot open shared object file: No such file or directory
>>
>> $ ldd div.exe
>> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll
>> (0x7ffef5c50000)
>> ??? => ??? (0x778f0000)
>> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000)
>> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll
>> (0x50dd0000)
>>
>> $ i686-w64-mingw32-gcc --version
>> i686-w64-mingw32-gcc (GCC) 5.4.0
>
> You need to paste or link to div.c, otherwise this seems a pointless
> exercise.
> See, I cannot repro:
>
> $ cat div.c
> #include <stdio.h>
> int main() {
> puts("hello world");
> }
man gcc
-fstack-protector
Emit extra code to check for buffer overflows, such as
stack smashing attacks. This is done by adding a guard
variable to functions with vulnerable objects. This
includes functions that call "alloca", and functions with
buffers larger than 8 bytes. The guards are initialized
when a function is entered and then checked when the
function exits. If a guard check fails, an error message
is printed and the program exits.
-fstack-protector-all
Like -fstack-protector except that all functions are protected.
-fstack-protector-strong
Like -fstack-protector but includes additional functions to
be protected --- those that have local array definitions,
or have references to local frame addresses.
I maybe should have used -fstack-protector-all, but I'm still learning :)
> $ x86_64-w64-mingw32-gcc -o div div.c
> $ ./div
> hello world
>
> $ x86_64-w64-mingw32-gcc -fstack-protector-strong -o div div.c
> $ ./div
> hello world
>
> $ ldd div
> ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x773a0000)
> kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x77180000)
> KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll
> (0x7fefd1a0000)
> msvcrt.dll => /cygdrive/c/Windows/system32/msvcrt.dll (0x7fefde00000)
note libssp-0 (or ???) isn't mentioned
you don't have any user defined functions, so it got optimized
out/never called??
Thanks
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-09-08 23:22 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 14:15 i686-w64-mingw32-gcc -fstack-protector-strong Lee
2017-09-08 15:04 ` Marco Atzeri
2017-09-08 18:53 ` Lee
2017-09-08 19:25 ` Marco Atzeri
2017-09-08 20:01 ` Lee
2017-09-08 20:10 ` Marco Atzeri
2017-09-08 21:08 ` Lee
2017-09-08 22:34 ` Yaakov Selkowitz
2017-09-08 23:10 ` Lee
2017-09-08 21:09 ` Nellis, Kenneth
2017-09-08 21:42 ` Lee
2017-09-08 23:01 ` Steven Penny
2017-09-08 23:22 ` Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).