aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Puccinelli2010-07-28 23:17:39 +0000
committerTony Puccinelli2010-07-28 23:17:39 +0000
commit145d8899dfb3bd0b7af88c812a2696c9da094cbf (patch)
tree99b5e836b0ff8f8a04b55fe8ab95d8edec04cd5a
parent9d236ac4d040cacdebd4e12e15a73279acfaf8f0 (diff)
downloadscummvm-rg350-145d8899dfb3bd0b7af88c812a2696c9da094cbf.tar.gz
scummvm-rg350-145d8899dfb3bd0b7af88c812a2696c9da094cbf.tar.bz2
scummvm-rg350-145d8899dfb3bd0b7af88c812a2696c9da094cbf.zip
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
svn-id: r51447
-rw-r--r--backends/platform/ps2/Makefile.ps22
-rw-r--r--backends/plugins/arm-relocs.cpp2
-rw-r--r--backends/plugins/ps2/main_prog.ld (renamed from backends/platform/ps2/main_prog.ld)0
-rw-r--r--backends/plugins/shorts-segment-manager.cpp4
-rw-r--r--backends/plugins/shorts-segment-manager.h8
5 files changed, 12 insertions, 4 deletions
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 5c60c4fca0..6d1a765456 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -91,7 +91,7 @@ PLUGIN_EXTRA_DEPS = $(srcdir)/backends/plugins/plugin.syms elf/scummvm.elf
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++
diff --git a/backends/plugins/arm-relocs.cpp b/backends/plugins/arm-relocs.cpp
index b00fb42f4a..8ceccfb7e8 100644
--- a/backends/plugins/arm-relocs.cpp
+++ b/backends/plugins/arm-relocs.cpp
@@ -115,7 +115,7 @@ bool DLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long offset
*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;
diff --git a/backends/platform/ps2/main_prog.ld b/backends/plugins/ps2/main_prog.ld
index 9dba69c50e..9dba69c50e 100644
--- a/backends/platform/ps2/main_prog.ld
+++ b/backends/plugins/ps2/main_prog.ld
diff --git a/backends/plugins/shorts-segment-manager.cpp b/backends/plugins/shorts-segment-manager.cpp
index eb2ab2d953..25962c504d 100644
--- a/backends/plugins/shorts-segment-manager.cpp
+++ b/backends/plugins/shorts-segment-manager.cpp
@@ -42,8 +42,8 @@ extern char _gp[]; // Value of gp register
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) {
diff --git a/backends/plugins/shorts-segment-manager.h b/backends/plugins/shorts-segment-manager.h
index 02f5221e8d..54a13d88e1 100644
--- a/backends/plugins/shorts-segment-manager.h
+++ b/backends/plugins/shorts-segment-manager.h
@@ -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 @@ public:
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);
}