From: Andrew Haley <aph@redhat.com>
To: Stephen Kell <srk31@srcf.ucam.org>
Cc: java@gcc.gnu.org
Subject: Re: CNI and interface methods
Date: Fri, 03 Apr 2009 14:13:00 -0000 [thread overview]
Message-ID: <49D61982.8030701@redhat.com> (raw)
In-Reply-To: <20090403135713.2fb36ecc@ernest-2.christs.cam.ac.uk>
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
next prev parent reply other threads:[~2009-04-03 14:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-02 19:38 Stephen Kell
2009-04-03 8:37 ` Andrew Haley
2009-04-03 10:35 ` Bryce McKinlay
[not found] ` <7230133d0904030328o55069f0do9147f879bcbd5e4f@mail.gmail.com>
2009-04-03 10:44 ` Andrew Haley
2009-04-03 18:54 ` Stephen Kell
2009-04-03 19:06 ` David Daney
2009-04-04 9:12 ` Andrew Haley
2009-04-03 13:57 ` Stephen Kell
2009-04-03 14:13 ` Andrew Haley [this message]
2009-04-03 18:42 ` Stephen Kell
-- strict thread matches above, loose matches on Subject: below --
2000-04-01 0:00 Oskar Liljeblad
2000-04-01 0:00 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49D61982.8030701@redhat.com \
--to=aph@redhat.com \
--cc=java@gcc.gnu.org \
--cc=srk31@srcf.ucam.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).