delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/08/04/17:10:13

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:mime-version
:content-type; q=dns; s=default; b=xfwdqfM3PaJOL+9L4RTplPiKm7V1q
rVuB0DyOAY85rq7f3Gdo7LQyw7snzpwTVhhLQjdqDvKZt1HzVIy2XsiTYzfrpdni
cGDrw8CKfEkisZOnXZDmVEDmXxHavqerihkqR4u2JQvVY2kzJRkvQohrUFdQelTd
Dma7ITIKe8e4kc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:mime-version
:content-type; s=default; bh=m8jDHoCm1emVTQReQZ449oAtIU0=; b=VtV
wYCaRFbBHlKAcv0u7VMupDv8cf5j8F/1TSVwU3jnRNgSGeYNijY/rZY9IH9ZXUAJ
GbYx0W/yGHuqJVrWxOE8RU7K6D76zqBYiYKqgq7eax49ly3xHvsXvXkQ+zU4HMDB
c5ILYvnx+QOmILgehChoFvtPuIP26wyqRncE8+N4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2
X-HELO: mx2.webnames.ca
X-ASG-Debug-ID: 1407186591-061d58211614a2fd0002-w5GHUG
X-Barracuda-Envelope-From: kclifford AT tranaptic DOT ca
X-Barracuda-AUTH-User: kclifford AT tranaptic DOT ca
X-Barracuda-Apparent-Source-IP: 184.66.146.153
From: "Keith Clifford" <kclifford AT tranaptic DOT ca>
To: <cygwin AT cygwin DOT com>
Subject: seg fault on override of a weak symbol in g++
Date: Mon, 4 Aug 2014 14:09:36 -0700
X-ASG-Orig-Subj: seg fault on override of a weak symbol in g++
Message-ID: <001e01cfb028$67884d00$3698e700$@tranaptic.ca>
MIME-Version: 1.0
X-Barracuda-Connect: S0106586d8f373e0d.gv.shawcable.net[184.66.146.153]
X-Barracuda-Start-Time: 1407186591
X-Barracuda-URL: http://10.9.9.131:8000/cgi-mod/mark.cgi
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=5.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.8121 Rule breakdown below pts rule name description ---- ---------------------- --------------------------------------------------
Note-from-DJ: This may be spam

------=_NextPart_000_001F_01CFAFED.BB2B22B0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi,
I was trying to build the ppl 1.1 library and got a seg fault when running
one of the tests. I've narrowed it down to the attached test case.

System: CYGWIN_NT-6.1 Keith-PC 1.7.31(0.272/5/3) 2014-07-25 11:26 x86_64
Cygwin

Both the following GCC's exhibit the problem Cygwin:
Using built-in specs.
COLLECT_GCC=i686-pc-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-mingw32/4.7.3/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with:
/usr/src/packages/mingw-gcc/64/mingw-gcc-4.7.3-1/src/gcc-4.7.3/configure
--srcdir=/usr/src/packages/mingw-gcc/64/mingw-gcc-4.7.3-1/src/gcc-4.7.3
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/mingw-gcc
-C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=i686-pc-mingw32
--without-libiconv-prefix --without-libintl-prefix
--with-sysroot=/usr/i686-pc-mingw32/sys-root
--with-build-sysroot=/usr/i686-pc-mingw32/sys-root
--enable-languages=c,c++,fortran,objc,obj-c++ --disable-sjlj-exceptions
--with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --disable-build-poststage1-with-cxx
--enable-version-specific-runtime-libs --disable-multilib
--enable-decimal-float=bid --disable-werror --enable-lto
Thread model: win32
gcc version 4.7.3 (GCC)

Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/4.8.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with:
/cygdrive/i/szsz/tmpp/cygwin64/mingw64-i686/mingw64-i686-gcc-4.8.3-1/src/gcc
-4.8.3/configure
--srcdir=/cygdrive/i/szsz/tmpp/cygwin64/mingw64-i686/mingw64-i686-gcc-4.8.3-
1/src/gcc-4.8.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share
--localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib
--datarootdir=/usr/share --docdir=/usr/share/doc/mingw64-i686-gcc
--htmldir=/usr/share/doc/mingw64-i686-gcc/html -C --build=x86_64-pc-cygwin
--host=x86_64-pc-cygwin --target=i686-w64-mingw32 --without-libiconv-prefix
--without-libintl-prefix --with-sysroot=/usr/i686-w64-mingw32/sys-root
--with-build-sysroot=/usr/i686-w64-mingw32/sys-root --disable-multilib
--disable-win32-registry
--enable-languages=c,ada,c++,fortran,lto,objc,obj-c++
--enable-fully-dynamic-strings --enable-graphite --enable-libgomp
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--enable-version-specific-runtime-libs --with-dwarf2 --with-gnu-ld
--with-gnu-as --with-tune=generic
--with-cloog-include=/usr/include/cloog-isl --with-system-zlib
--libexecdir=/usr/lib
Thread model: win32
gcc version 4.8.3 (GCC)


When built with the default Cygwin compiler the problem doesn't occur.
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with:
/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.3-2/src/gcc-4.8.3/configure
--srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.3-2/src/gcc-4.8.3
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share
--docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
--build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--without-libiconv-prefix --without-libintl-prefix --enable-shared
--enable-shared-libgcc --enable-static
--enable-version-specific-runtime-libs --enable-bootstrap
--disable-__cxa_atexit --with-dwarf2 --with-tune=generic
--enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers
--with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as
--with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix
--without-libintl-prefix --with-system-zlib --libexecdir=/usr/lib
Thread model: posix
gcc version 4.8.3 (GCC)

In the attached files in weak.cpp if the line
	static ios_base::Init __ioinit;
is commented out the seg fault doesn't occur. Doing a disassembly of weak.o
(objdump -d weak.o) shows that the call includes a nonzero offset that gets
applied when the weak symbol is overridden by the function in strong.o. The
offset is zero if the above mentioned line is commented out. 

Regards,
Keith



------=_NextPart_000_001F_01CFAFED.BB2B22B0
Content-Type: text/plain;
	name="strong.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="strong.cpp"

#include <stdio.h>

extern "C"
void weak_strong(void)
{
  printf( "STRONG\n" );
}


------=_NextPart_000_001F_01CFAFED.BB2B22B0
Content-Type: text/plain;
	name="weak.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="weak.cpp"

#include <stdio.h>

#include <istream>

namespace std _GLIBCXX_VISIBILITY(default)
{
  static ios_base::Init __ioinit;
} // namespace

extern "C" void
weak_strong(void)
  __attribute__((weak));

void weak_strong(void)
{
  printf( "WEAK\n" );
}

int main( void )
{
  weak_strong();
  
  return 0;
}
------=_NextPart_000_001F_01CFAFED.BB2B22B0
Content-Type: application/octet-stream;
	name="Makefile"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Makefile"

CPP =3D i686-pc-mingw32-g++=0A=
# CPP =3D i686-w64-mingw32-g++=0A=
=0A=
all: weak.exe=0A=
=0A=
weak.exe: weak.o strong.o=0A=
	$(CPP) -o weak.exe weak.o strong.o=0A=
=0A=
.cpp.o:=0A=
	$(CPP) -DHAVE_CONFIG_H -I. -I..  -I.. -I../src -I/home/cross-gcc/4.9.1/cro=
ss-local/include   -g -O2 -frounding-math -O2 -pipe -W -Wall -c -o $@ $<=0A=
=20=20=0A=
clean:=0A=
	rm weak.o strong.o=0A=


------=_NextPart_000_001F_01CFAFED.BB2B22B0
Content-Type: text/plain; charset=us-ascii

--
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
------=_NextPart_000_001F_01CFAFED.BB2B22B0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019