[uClibc-cvs] CVS update of uClibc (Rules.mak ldso/ldso/powerpc/dl-startup.h)

Erik Andersen andersen at codepoet.org
Fri Aug 6 16:11:44 UTC 2004


    Date: Friday, August 6, 2004 @ 10:11:44
  Author: andersen
    Path: /var/cvs/uClibc

Modified: Rules.mak (1.165 -> 1.166) ldso/ldso/powerpc/dl-startup.h (1.11
          -> 1.12)

Joakim Tjernlund writes:

This patch makes -fpic work for PCC and optimzes the relcation by moving the cache
flushing stuff to JMP relocs only. Actually PPCs ldso can only handle small
GOT tables(<=8192 entries)anyhow, so it makes little sense to compile PPC with -fPIC.
libuClibc shrunk from 340724 to 330780 bytes with -fpic.


Index: uClibc/Rules.mak
diff -u uClibc/Rules.mak:1.165 uClibc/Rules.mak:1.166
--- uClibc/Rules.mak:1.165	Fri Jul 16 14:22:22 2004
+++ uClibc/Rules.mak	Fri Aug  6 10:11:42 2004
@@ -88,7 +88,15 @@
 ARFLAGS:=r
 
 OPTIMIZATION:=
-PICFLAG:=-fPIC
+
+# PowerPC can hold 8192 entries in its GOT with -fpic which is more than enough. Therefore use
+# -fpic which will reduce code size and generates faster code.
+ifeq ($(strip $(TARGET_ARCH)),powerpc)
+	PICFLAG:=-fpic
+else
+	PICFLAG:=-fPIC
+endif
+
 # Some nice CPU specific optimizations
 ifeq ($(strip $(TARGET_ARCH)),i386)
 	OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
Index: uClibc/ldso/ldso/powerpc/dl-startup.h
diff -u uClibc/ldso/ldso/powerpc/dl-startup.h:1.11 uClibc/ldso/ldso/powerpc/dl-startup.h:1.12
--- uClibc/ldso/ldso/powerpc/dl-startup.h:1.11	Tue Apr 20 00:33:03 2004
+++ uClibc/ldso/ldso/powerpc/dl-startup.h	Fri Aug  6 10:11:43 2004
@@ -38,15 +38,15 @@
 	 Elf32_Addr finaladdr=(SYMBOL)+(RELP)->r_addend;\
 	if (type==R_PPC_RELATIVE) {			\
 		*REL=(Elf32_Word)(LOAD)+(RELP)->r_addend;\
+	} else if (type==R_PPC_ADDR32 || type==R_PPC_GLOB_DAT) {\
+		*REL=finaladdr;				\
 	} else if (type==R_PPC_JMP_SLOT) {		\
 		Elf32_Sword delta=finaladdr-(Elf32_Word)(REL);\
 		*REL=OPCODE_B(delta);			\
-	} else if (type==R_PPC_ADDR32) {		\
-		*REL=finaladdr;				\
+		PPC_DCBST(REL); PPC_SYNC; PPC_ICBI(REL);\
 	} else {					\
-	  _dl_exit(100+ELF32_R_TYPE((RELP)->r_info));	\
+		_dl_exit(100+ELF32_R_TYPE((RELP)->r_info));\
 	}						\
-	PPC_DCBST(REL); PPC_SYNC; PPC_ICBI(REL);	\
 	}
 /*
  * Transfer control to the user's application, once the dynamic loader



More information about the uClibc-cvs mailing list