mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 04:19:21 +08:00
264b5e137e
The problem this patch fixes showed up after updating to gcc-5.3.0. The cuplrit is a change in gcc when emitting section attributes. It only shows up when building without optimization. Effect in Cygwin: ws2_32 functions failed to load. In the original code the definition of "NO_COPY wsadata" was preceeding an __asm__ block (the definition of the _wsock_init wrapper), while the definition of "NO_COPY here" immediately follows the same assembler block. When gcc-5.3.0 emits assembler code for the wsadata definition, it emits the .data_cygwin_nocopy section attribute. Next it emits the assembler output for the __asm_ block, entirely ignoring its content. The __asm__ block adds a .text section definition. Eventually gcc emits assembler code for the here definition. However, apparently gcc still "knows" that it just emitted the .data_cygwin_nocopy section attribute and so doesn't redefine it. Remember the __asm__? It changed the section to .text. So with gcc-4.9.3 we got: .section .data_cygwin_nocopy,"w" wsadata: __asm__ block: .text .section .data_cygwin_nocopy,"w" here: With gcc 5.3.0 we now get: .section .data_cygwin_nocopy,"w" wsadata: __asm__ block: .text here: So "here" is now in the .text segment which is read-only. Hilarity ensues. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cygwin documentation is available on the net at http://cygwin.com You might especially be interested in http://cygwin.com/faq/faq.programming.html#faq.programming.building-cygwin