NetBSD Problem Report #43041

From www@NetBSD.org  Tue Mar 23 09:29:26 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 8EE9C63B86C
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 23 Mar 2010 09:29:26 +0000 (UTC)
Message-Id: <20100323092926.241D663B11D@www.NetBSD.org>
Date: Tue, 23 Mar 2010 09:29:26 +0000 (UTC)
From: dennis.c.ferguson@gmail.com
Reply-To: dennis.c.ferguson@gmail.com
To: gnats-bugs@NetBSD.org
Subject: powerpc64 c++ compiler emits code with reference to undefined __libc_stack_end
X-Send-Pr-Version: www-1.0

>Number:         43041
>Category:       port-powerpc
>Synopsis:       powerpc64 c++ compiler emits code with reference to undefined __libc_stack_end
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 23 09:30:00 +0000 2010
>Closed-Date:    Sat Mar 27 20:13:11 +0000 2010
>Last-Modified:  Sat Mar 27 20:15:02 +0000 2010
>Originator:     Dennis Ferguson
>Release:        very recent 5.99.24
>Organization:
>Environment:
NetBSD timerxxx.akit-ferguson.com 5.99.24 NetBSD 5.99.24 (GENERIC) #0: Mon Mar 22 15:11:34 HKT 2010  dennis@dennisbigmac.akit-ferguson.com:/Users/dennis/NetBSD/5.0-current/src/sys/arch/amd64/compile/obj/GENERIC amd64

>Description:
Loading a powerpc64 c++ program (any program, I think) fails
with an unresolved external reference to __libc_stack_end.
Here's the first one build.sh tries to make:

#      link  grodvi/grodvi
/usr/src/obj/tooldir.NetBSD-5.99.24-amd64/bin/powerpc64--netbsd-gcc  -B/usr/src/obj/destdir.macppc/usr/lib/ -B/usr/src/obj/destdir.macppc/usr/lib/  -Wl,-nostdlib       -o grodvi  dvi.o /usr/src/gnu/usr.bin/groff/src/libs/libdriver/obj/libdriver.a /usr/src/gnu/usr.bin/groff/src/libs/libgroff/obj/libgroff.a -lm -lsupc++      -L/usr/src/obj/destdir.macppc/usr/lib   -Wl,-rpath-link,/usr/src/obj/destdir.macppc/lib  -L/usr/src/obj/destdir.macppc/lib -Wl,-rpath-link,/usr/src/obj/destdir.macppc/usr/lib  -L/usr/src/obj/destdir.macppc/usr/lib
/usr/src/obj/destdir.macppc/usr/lib/libgcc_eh.a(unwind-dw2.o):(.toc+0x20): undefined reference to `__libc_stack_end'
collect2: ld returned 1 exit status

The code which makes the reference is being emitted by
the compiler.
>How-To-Repeat:
Do a:

    MACHINE=macppc64 ./build.sh distribution
>Fix:
The code in question is in
src/gnu/dist/gcc4/gcc/config/rs6000/linux-unwind.h,
which ends up being included in the compiler via
src/gnu/dist/gcc4/gcc/config/rs6000/netbsd64.h.  I
think the latter is just a boo-boo; even if the external
reference were somehow fixed I don't think the rest of
the code can be usefully used with NetBSD.  Note that
the thing being done in there is more of a platform thing
than a particular processor thing; if rs6000/netbsd64.h
needed an equivalent then surely so would rs6000/netbsd.h
and likely the other NetBSD ports too.  Because rs6000/netbsd.h
gets by without it I'm fairly comfortable the following is
correct:


Index: netbsd64.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc4/gcc/config/rs6000/netbsd64.h,v
retrieving revision 1.5
diff -u -r1.5 netbsd64.h
--- netbsd64.h	4 Feb 2008 04:20:51 -0000	1.5
+++ netbsd64.h	23 Mar 2010 09:06:11 -0000
@@ -571,6 +571,4 @@
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"

-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #define POWERPC_NETBSD

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-powerpc-maintainer->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Wed, 24 Mar 2010 07:08:54 +0000
Responsible-Changed-Why:
i agree with dennis' analysis and will merge this change after some testing.


State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Sat, 27 Mar 2010 20:13:11 +0000
State-Changed-Why:
i commited the change.  thanks!


From: matthew green <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/43041 CVS commit: src/gnu/dist/gcc4/gcc/config/rs6000
Date: Sat, 27 Mar 2010 20:11:06 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Sat Mar 27 20:11:06 UTC 2010

 Modified Files:
 	src/gnu/dist/gcc4/gcc/config/rs6000: netbsd64.h

 Log Message:
 don't include linux unwind support.  we don't do this on 32 bit ppc,
 we don't have the symbols to support it, and it breaks c++ linking.
 from dennis.c.ferguson@gmail.com in PR#43041.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/gnu/dist/gcc4/gcc/config/rs6000/netbsd64.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.