Add arm-epoc-pe specific linker script
authorNick Clifton <nickc@redhat.com>
Thu, 2 Dec 1999 11:49:20 +0000 (11:49 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 2 Dec 1999 11:49:20 +0000 (11:49 +0000)
ld/ChangeLog
ld/Makefile.am
ld/Makefile.in
ld/emulparams/arm_epoc_pe.sh
ld/scripttempl/epocpe.sc [new file with mode: 0644]

index e5c5ec1..cc26ce0 100644 (file)
@@ -1,3 +1,13 @@
+1999-12-02  Nick Clifton  <nickc@cygnus.com>
+
+       * Makefile.am: Fix arm-epoc-pe dependencies.
+       * Makefile.in: Regenerate.
+       
+       * emulparams/arm_epoc_pe.sh (SCRIPT_NAME): Set to epocpe.
+
+       * scripttempl/epocpe.sc: New file: copy of pe.sc, customised for
+       EPOC by placing .rdata into .text.
+
 1999-11-26  Andreas Schwab  <schwab@suse.de>
 
        * configure.in: Put AC_MSG_CHECKING/AC_MSG_RESULT around check for
index 2ee0ec7..1edc12f 100644 (file)
@@ -314,7 +314,7 @@ earmnbsd.c: $(srcdir)/emulparams/armnbsd.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
        ${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
 earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
-  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
        ${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
 earmpe.c: $(srcdir)/emulparams/armpe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
index 3aec7e7..94536dd 100644 (file)
@@ -1015,7 +1015,7 @@ earmnbsd.c:       $(srcdir)/emulparams/armnbsd.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
        ${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
 earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
-  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+  $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
        ${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
 earmpe.c: $(srcdir)/emulparams/armpe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
index ca1a309..04fa22d 100644 (file)
@@ -1,5 +1,5 @@
 ARCH=arm
-SCRIPT_NAME=pe
+SCRIPT_NAME=epocpe
 OUTPUT_FORMAT="epoc-pei-arm-little"
 LITTLE_OUTPUT_FORMAT="epoc-pei-arm-little"
 BIG_OUTPUT_FORMAT="epoc-pei-arm-big"
diff --git a/ld/scripttempl/epocpe.sc b/ld/scripttempl/epocpe.sc
new file mode 100644 (file)
index 0000000..eda6696
--- /dev/null
@@ -0,0 +1,151 @@
+# Linker script for PE.
+
+if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
+  RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+fi
+
+# We can't easily and portably get an unquoted $ in a shell
+# substitution, so we do this instead.
+# Sorting of the .foo$* sections is required by the definition of
+# grouped sections in PE.
+# Sorting of the file names in R_IDATA is required by the
+# current implementation of dlltool (this could probably be changed to
+# use grouped sections instead).
+if test "${RELOCATING}"; then
+  R_TEXT='*(SORT(.text$*))'
+  R_DATA='*(SORT(.data$*))'
+  R_RDATA='*(SORT(.rdata$*))'
+  R_IDATA='
+    SORT(*)(.idata$2)
+    SORT(*)(.idata$3)
+    /* These zeroes mark the end of the import list.  */
+    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
+    SORT(*)(.idata$4)
+    SORT(*)(.idata$5)
+    SORT(*)(.idata$6)
+    SORT(*)(.idata$7)'
+  R_CRT='*(SORT(.CRT$*))'
+  R_RSRC='*(SORT(.rsrc$*))'
+else
+  R_TEXT=
+  R_DATA=
+  R_RDATA=
+  R_IDATA=
+  R_CRT=
+  R_RSRC=
+fi
+
+cat <<EOF
+${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
+${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
+
+${LIB_SEARCH_DIRS}
+
+ENTRY(_mainCRTStartup)
+
+SECTIONS
+{
+  .text ${RELOCATING+ __image_base__ + __section_alignment__ } : 
+  {
+    ${RELOCATING+ *(.init)}
+    *(.text)
+    ${R_TEXT}
+    *(.glue_7t)
+    *(.glue_7)
+    ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
+                       LONG (-1); *(.ctors); *(.ctor); LONG (0); }
+    ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
+                       LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
+    ${RELOCATING+ *(.fini)}
+    /* ??? Why is .gcc_exc here?  */
+    ${RELOCATING+ *(.gcc_exc)}
+    ${RELOCATING+ etext = .;}
+    *(.gcc_except_table)
+
+    /* For EPOC the read only data is located at the end of the .text
+    section */
+    *(.rdata)
+    ${R_RDATA}
+    *(.eh_frame)
+  }
+
+  /* The Cygwin32 library uses a section to avoid copying certain data
+     on fork.  This used to be named ".data$nocopy".  The linker used
+     to include this between __data_start__ and __data_end__, but that
+     breaks building the cygwin32 dll.  Instead, we name the section
+     ".data_cygwin_nocopy" and explictly include it after __data_end__. */
+
+  .data ${RELOCATING+BLOCK(__section_alignment__)} : 
+  {
+    ${RELOCATING+__data_start__ = . ;}
+    *(.data)
+    *(.data2)
+    ${R_DATA}
+    ${RELOCATING+__data_end__ = . ;}
+    ${RELOCATING+*(.data_cygwin_nocopy)}
+  }
+
+  .bss ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    ${RELOCATING+__bss_start__ = . ;}
+    *(.bss)
+    *(COMMON)
+    ${RELOCATING+__bss_end__ = . ;}
+  }
+
+  .edata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    *(.edata)
+  }
+
+  /DISCARD/ :
+  {
+    *(.debug\$S)
+    *(.debug\$T)
+    *(.debug\$F)
+    *(.drectve)
+  }
+
+  .idata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    /* This cannot currently be handled with grouped sections.
+       See pe.em:sort_sections.  */
+    ${R_IDATA}
+  }
+  
+  .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
+  {                                    
+    ${R_CRT}
+  }
+
+  .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    /* end is deprecated, don't use it */
+    ${RELOCATING+ end = .;}
+    ${RELOCATING+ _end = .;}
+    ${RELOCATING+ __end__ = .;}
+  }
+
+  .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
+  {                                    
+    *(.reloc)
+  }
+
+  .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
+  {                                    
+    *(.rsrc)
+    ${R_RSRC}
+  }
+
+  .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
+  {
+    [ .stab ]
+  }
+
+  .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
+  {
+    [ .stabstr ]
+  }
+
+}
+EOF