[Scummvm-cvs-logs] SF.net SVN: scummvm:[51447] scummvm/branches/gsoc2010-plugins/backends

toneman1138 at users.sourceforge.net toneman1138 at users.sourceforge.net
Thu Jul 29 01:17:39 CEST 2010


Revision: 51447
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51447&view=rev
Author:   toneman1138
Date:     2010-07-28 23:17:39 +0000 (Wed, 28 Jul 2010)

Log Message:
-----------
added some comments to shorts-segment-manager, moved main engine linker script for ps2 into the plugins folder as it is only used when dynamic plugins are enabled

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2
    scummvm/branches/gsoc2010-plugins/backends/plugins/arm-relocs.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.h

Added Paths:
-----------
    scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/main_prog.ld

Removed Paths:
-------------
    scummvm/branches/gsoc2010-plugins/backends/platform/ps2/main_prog.ld

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2	2010-07-28 23:09:42 UTC (rev 51446)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ps2/Makefile.ps2	2010-07-28 23:17:39 UTC (rev 51447)
@@ -91,7 +91,7 @@
 PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o
 PLUGIN_LDFLAGS += -nostartfiles -Wl,-q,--just-symbols,elf/scummvm.elf,-T$(srcdir)/backends/plugins/ps2/plugin.ld,--retain-symbols-file,$(srcdir)/backends/plugins/plugin.syms -lstdc++ -lc
 
-LDFLAGS = -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T main_prog.ld
+LDFLAGS = -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(srcdir)/backends/plugins/ps2/main_prog.ld
 LDFLAGS += -L $(PS2SDK)/ee/lib -L .
 LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
 LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++ 

Deleted: scummvm/branches/gsoc2010-plugins/backends/platform/ps2/main_prog.ld
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/ps2/main_prog.ld	2010-07-28 23:09:42 UTC (rev 51446)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/ps2/main_prog.ld	2010-07-28 23:17:39 UTC (rev 51447)
@@ -1,99 +0,0 @@
-ENTRY(_start);
-
-SECTIONS {
-	.text 0x00100000: {
-		_ftext = . ;
-		*(.text)
-		*(.text.*)
-		*(.gnu.linkonce.t*)
-		KEEP(*(.init))
-		KEEP(*(.fini))
-		QUAD(0)
-	}
-
-	PROVIDE(_etext = .);
-	PROVIDE(etext = .);
-
-	.reginfo : { *(.reginfo) }
-
-	/* Global/static constructors and deconstructors. */
-	.ctors ALIGN(16): {
-		KEEP(*crtbegin*.o(.ctors))
-		KEEP(*(EXCLUDE_FILE(*crtend*.o) .ctors))
-		KEEP(*(SORT(.ctors.*)))
-		KEEP(*(.ctors))
-	}
-	.dtors ALIGN(16): {
-		KEEP(*crtbegin*.o(.dtors))
-		KEEP(*(EXCLUDE_FILE(*crtend*.o) .dtors))
-		KEEP(*(SORT(.dtors.*)))
-		KEEP(*(.dtors))
-	}
-
-	/* Static data.  */
-	.rodata ALIGN(128): {
-		*(.rodata)
-		*(.rodata.*)
-		*(.gnu.linkonce.r*)
-	}
-
-	.data ALIGN(128): {
-		_fdata = . ;
-		*(.data)
-		*(.data.*)
-		*(.gnu.linkonce.d*)
-		SORT(CONSTRUCTORS)
-	}
-
-	.rdata ALIGN(128): { *(.rdata) }
-	.gcc_except_table ALIGN(128): { *(.gcc_except_table) }
-
-	_gp = ALIGN(128) + 0x7ff0;
-	.lit4 ALIGN(128): { *(.lit4) }
-	.lit8 ALIGN(128): { *(.lit8) }
-
-	.sdata ALIGN(128): {
-		*(.sdata)
-		*(.sdata.*)
-		*(.gnu.linkonce.s*)
-	}
-
-	_edata = .;
-	PROVIDE(edata = .);
-
-	/* Uninitialized data.  */
-	.sbss ALIGN(128) : {
-		_fbss = . ;
-		*(.sbss)
-		*(.sbss.*)
-		*(.gnu.linkonce.sb*)
-		*(.scommon)
-	}
-
-	/*This "plugin hole" is so the plugins can all have global small data
-	  in the same place.*/
-	__plugin_hole_start = .;
-	. = _gp + 0x7ff0;
-	__plugin_hole_end = .;
-
-	COMMON		  :
-	{
-	 *(COMMON)
-	}
-	. = ALIGN(128);
-
-	.bss ALIGN(128) : {
-		*(.bss)
-		*(.bss.*)
-		*(.gnu.linkonce.b*)
-	}
-	_end_bss = .;
-
-	_end = . ;
-	PROVIDE(end = .);
-
-	/* Symbols needed by crt0.s.  */
-	PROVIDE(_heap_size = -1);
-	PROVIDE(_stack = -1);
-	PROVIDE(_stack_size = 128 * 1024);
-}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/arm-relocs.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/arm-relocs.cpp	2010-07-28 23:09:42 UTC (rev 51446)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/arm-relocs.cpp	2010-07-28 23:17:39 UTC (rev 51447)
@@ -115,7 +115,7 @@
 				*target = relocation;
 
 				DBG("R_ARM_TARGET1: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target);
-				DBG("Make sure --target1-abs is a flag to LD.\n");
+				DBG("Make sure --target1-abs is a flag to LD!\n");
 			}
 			break;
 

Copied: scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/main_prog.ld (from rev 51401, scummvm/branches/gsoc2010-plugins/backends/platform/ps2/main_prog.ld)
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/main_prog.ld	                        (rev 0)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/ps2/main_prog.ld	2010-07-28 23:17:39 UTC (rev 51447)
@@ -0,0 +1,99 @@
+ENTRY(_start);
+
+SECTIONS {
+	.text 0x00100000: {
+		_ftext = . ;
+		*(.text)
+		*(.text.*)
+		*(.gnu.linkonce.t*)
+		KEEP(*(.init))
+		KEEP(*(.fini))
+		QUAD(0)
+	}
+
+	PROVIDE(_etext = .);
+	PROVIDE(etext = .);
+
+	.reginfo : { *(.reginfo) }
+
+	/* Global/static constructors and deconstructors. */
+	.ctors ALIGN(16): {
+		KEEP(*crtbegin*.o(.ctors))
+		KEEP(*(EXCLUDE_FILE(*crtend*.o) .ctors))
+		KEEP(*(SORT(.ctors.*)))
+		KEEP(*(.ctors))
+	}
+	.dtors ALIGN(16): {
+		KEEP(*crtbegin*.o(.dtors))
+		KEEP(*(EXCLUDE_FILE(*crtend*.o) .dtors))
+		KEEP(*(SORT(.dtors.*)))
+		KEEP(*(.dtors))
+	}
+
+	/* Static data.  */
+	.rodata ALIGN(128): {
+		*(.rodata)
+		*(.rodata.*)
+		*(.gnu.linkonce.r*)
+	}
+
+	.data ALIGN(128): {
+		_fdata = . ;
+		*(.data)
+		*(.data.*)
+		*(.gnu.linkonce.d*)
+		SORT(CONSTRUCTORS)
+	}
+
+	.rdata ALIGN(128): { *(.rdata) }
+	.gcc_except_table ALIGN(128): { *(.gcc_except_table) }
+
+	_gp = ALIGN(128) + 0x7ff0;
+	.lit4 ALIGN(128): { *(.lit4) }
+	.lit8 ALIGN(128): { *(.lit8) }
+
+	.sdata ALIGN(128): {
+		*(.sdata)
+		*(.sdata.*)
+		*(.gnu.linkonce.s*)
+	}
+
+	_edata = .;
+	PROVIDE(edata = .);
+
+	/* Uninitialized data.  */
+	.sbss ALIGN(128) : {
+		_fbss = . ;
+		*(.sbss)
+		*(.sbss.*)
+		*(.gnu.linkonce.sb*)
+		*(.scommon)
+	}
+
+	/*This "plugin hole" is so the plugins can all have global small data
+	  in the same place.*/
+	__plugin_hole_start = .;
+	. = _gp + 0x7ff0;
+	__plugin_hole_end = .;
+
+	COMMON		  :
+	{
+	 *(COMMON)
+	}
+	. = ALIGN(128);
+
+	.bss ALIGN(128) : {
+		*(.bss)
+		*(.bss.*)
+		*(.gnu.linkonce.b*)
+	}
+	_end_bss = .;
+
+	_end = . ;
+	PROVIDE(end = .);
+
+	/* Symbols needed by crt0.s.  */
+	PROVIDE(_heap_size = -1);
+	PROVIDE(_stack = -1);
+	PROVIDE(_stack_size = 128 * 1024);
+}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp	2010-07-28 23:09:42 UTC (rev 51446)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.cpp	2010-07-28 23:17:39 UTC (rev 51447)
@@ -42,8 +42,8 @@
 DECLARE_SINGLETON(ShortSegmentManager);	// For singleton
 
 ShortSegmentManager::ShortSegmentManager() {
-	_shortsStart = &__plugin_hole_start ;
-	_shortsEnd = &__plugin_hole_end;
+	_shortsStart = &__plugin_hole_start ;	//shorts segment begins at the plugin hole we made when linking
+	_shortsEnd = &__plugin_hole_end;		//and ends at the end of that hole.
 }
 
 ShortSegmentManager::Segment *ShortSegmentManager::newSegment(int size, char *origAddr) {

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.h	2010-07-28 23:09:42 UTC (rev 51446)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/shorts-segment-manager.h	2010-07-28 23:17:39 UTC (rev 51447)
@@ -32,6 +32,12 @@
 
 #define ShortsMan ShortSegmentManager::instance()
 
+/**
+ * Manages the segments of small data put in the gp-relative area for MIPS processors,
+ * and lets these segments be handled differently in the ELF loader.
+ * Since there's no true dynamic linker to change the GP register between plugins and the main engine,
+ * custom linker scripts ensure the GP-area is in the same place for both.
+ */
 class ShortSegmentManager : public Common::Singleton<ShortSegmentManager> {
 private:
 	char *_shortsStart;
@@ -41,6 +47,8 @@
 	char *getShortsStart() {
 		return _shortsStart;
 	}
+
+	// Returns whether or not an absolute address is in the GP-relative section.
 	bool inGeneralSegment(char *addr) {
 		return ((char *)addr >= _shortsStart && (char *)addr < _shortsEnd);
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list