From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20823 invoked by alias); 3 Apr 2009 14:13:36 -0000 Received: (qmail 20812 invoked by uid 22791); 3 Apr 2009 14:13:34 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Apr 2009 14:13:27 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n33EDPtv019952; Fri, 3 Apr 2009 10:13:25 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n33EDPCK031448; Fri, 3 Apr 2009 10:13:26 -0400 Received: from zebedee.pink (vpn-12-137.rdu.redhat.com [10.11.12.137]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n33EDNkn021961; Fri, 3 Apr 2009 10:13:24 -0400 Message-ID: <49D61982.8030701@redhat.com> Date: Fri, 03 Apr 2009 14:13:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Stephen Kell CC: java@gcc.gnu.org Subject: Re: CNI and interface methods References: <20090402193827.GD4939@font.cl.cam.ac.uk> <49D5CAD4.8040700@redhat.com> <20090403135713.2fb36ecc@ernest-2.christs.cam.ac.uk> In-Reply-To: <20090403135713.2fb36ecc@ernest-2.christs.cam.ac.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg00012.txt.bz2 Stephen Kell wrote: > On Fri, 03 Apr 2009 09:37:40 +0100, Andrew Haley wrote: >> It's because you're using -Bsymbolic but not -fpic. -Bsymbolic is >> dangerous, and any use of it without PIC means instant death. So, >> compile everything PIC, even the executable, and you'll be fine. >> That worked for me on your example. > > Thanks for this. I thought I already was compiling everything -fpic, > but maybe I missed something. Was there a particular make rule that was > in need of -fpic, that you altered? I still can't find it. > > (Actually I was using -fPIC, but I've tried again with -fpic instead, in > case it made a difference... still getting the same segfault though.) Here are my changes. I also got rid of antlr-runtime which didn't seem necessary. Andrew. --- Makefile~ 2009-04-02 19:31:29.000000000 +0100 +++ Makefile 2009-04-03 09:31:06.000000000 +0100 @@ -16,13 +16,13 @@ default: cake %.o: %.cpp - g++ -c -o "$@" ${CXXFLAGS} "$<" + g++ -c -fpic -o "$@" ${CXXFLAGS} "$<" main.o: main.cpp parser-recursive Makefile antlr-headers - g++ -c -o "$@" ${CXXFLAGS} "$<" + g++ -c -fpic -o "$@" ${CXXFLAGS} "$<" -cake: main.o $(OBJS) antlr-runtime-3.1.jar.so stringtemplate-3.2.jar.so antlr-3.1.2.jar.so junit-3.8.2.jar.so - gcj $(GCJFLAGS) -Wl,-R. -o "$@" $(OBJS) "$<" -lstdc++ parser/cakeJava{Parser,Lexer}*.o antlr-runtime-3.1.jar.so stringtemplate-3.2.jar.so antlr-3.1.2.jar.so junit-3.8.2.jar.so +cake: main.o $(OBJS) stringtemplate-3.2.jar.so antlr-3.1.2.jar.so junit-3.8.2.jar.so + gcj $(GCJFLAGS) -Wl,-R. -o "$@" $(OBJS) "$<" -lstdc++ parser/cakeJava{Parser,Lexer}*.o stringtemplate-3.2.jar.so antlr-3.1.2.jar.so junit-3.8.2.jar.so # FIXME: to build, change the following .jar paths @@ -41,14 +41,14 @@ org.antlr.runtime.IntStream %.jar.so: %.jar - gcj $(GCJFLAGS) -shared -fPIC -Wl,-Bsymbolic "$<" -o "$@" + gcj $(GCJFLAGS) -shared -g -fPIC -Wl,-Bsymbolic "$<" -o "$@" #java-headers: # gcjh -d gcjh_generated -classpath .:$(CLASSPATH) java.io.File java.io.FileInputStream .PHONY: parser-recursive parser-recursive: - $(MAKE) -C parser + $(MAKE) -C parser CLASSPATH=$(CLASSPATH) .PHONY: clean clean: --- parser/Makefile~ 2009-04-02 19:32:24.000000000 +0100 +++ parser/Makefile 2009-04-03 09:31:06.000000000 +0100 @@ -33,14 +33,14 @@ $(ANTLR) "$<" %.class: %.java - gcj -MD -C -Wno-unused "$<" + gcj -g -MD -C -Wno-unused "$<" %.o: %.class - gcj $(JFLAGS) -MD -Wno-unused -c -o "$@" "$<" + gcj $(JFLAGS) -MD -Wno-unused -c -o "$@" "$<" -g -fpic # HACK: also make nested classes' object files, because we can't enumerate these statically for Makefile purposes for classfile in "$*"\$$*.class; do \ if [[ $$classfile != "$*"\$$"*".class ]]; then \ - gcj -o $$( echo "$$classfile" | sed 's/class$$/o/') -MD -Wno-unused -c "$$classfile"; \ + gcj -o $$( echo "$$classfile" | sed 's/class$$/o/') -MD -Wno-unused -fpic -c "$$classfile"; \ fi; \ done