This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] ppc64 add -fpic back
- From: Steve Munroe <sjmunroe at vnet dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: aj at suse dot de, geoffk at geoffk dot org, roland at frob dot com
- Date: Fri, 27 Sep 2002 13:38:07 -0500
- Subject: [PATCH] ppc64 add -fpic back
Found this one while testing with the latest gcc-3.2. Before -fpic made no
difference for PowerPC64 (all TOC based code is PIC) and specifying it
resulted in a annoying warning message. Now gcc takes the absence of -fpic
as permission to do some aggressive optimizations of call stubs.
The net is shared objects built without -fpic will fail. So I need to
add -fpic back to all the places I removed previously.
2002-09-27 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/powerpc64/Makefile[build-shared]: Define pic-ccflag.
Add -fpic to CFLAGS-initfini.s.
diff -rupPN libc23-cvstip-20020923/sysdeps/powerpc/powerpc64/Makefile libc23-ppc64-stat/sysdeps/powerpc/powerpc64/Makefile
--- libc23-cvstip-20020923/sysdeps/powerpc/powerpc64/Makefile Tue Sep 17 18:50:02 2002
+++ libc23-ppc64-stat/sysdeps/powerpc/powerpc64/Makefile Tue Sep 24 09:52:42 2002
@@ -4,16 +4,21 @@
+cflags += -Wa,-mppc64 -mpowerpc64
asm-CPPFLAGS += -Wa,-mppc64
-# On PPC64, -fpic is the default so we don't need to specify it.
-# Also early compilers would issue a warning if -fpic was specified.
# Each TOC entry takes 8 bytes and the TOC holds up to 2^16 bytes,
-# or 8192 entries. If the TOC fills up try -minimal-toc.
+# or 8192 entries.
+# If -fpic is not specified, the latest gcc-3.2.1 now generates
+# different code for call stubs (without the TOC reload).
+# Shared objects need the TOC reload so specify -fpic.
+ifeq (yes,$(build-shared))
+pic-ccflag = -fpic
+endif
+
ifeq ($(subdir),csu)
ifneq ($(elf),no)
# The initfini generation code doesn't work in the presence of -g1 or
# higher, so we use -g0.
-CFLAGS-initfini.s = -g0 -O1
+CFLAGS-initfini.s = -g0 -fpic -O1
endif
endif