PR ld/6766
[binutils-gdb.git] / ld / scripttempl / elf32crx.sc
index 63401fe7e2c1c598e05d9534310d1fadce92174b..c320bda93e60e7cea618fe377c698ba917eaff58 100644 (file)
@@ -10,15 +10,9 @@ cat <<EOF
 
 /* Example Linker Script for linking NS CRX elf32 files. */
 
-/* The next line forces the entry point (${ENTRY} in this script)
-   to be entered in the output file as an undefined symbol.
-   It is needed in case the entry point is not called explicitly
-   (which is the usual case) AND is in an archive.  */
-
 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
 OUTPUT_ARCH(${ARCH})
-EXTERN(${ENTRY})
-ENTRY(${ENTRY})
+${RELOCATING+ENTRY(${ENTRY})}
 
 /* Define memory regions.  */
 MEMORY
@@ -90,14 +84,15 @@ SECTIONS
        doesn't matter which directory crtbegin.o
        is in.  */
 
-    KEEP (*crtbegin*.o(.ctors))
-
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*crtbegin?.o(.ctors))
+                                      
     /* We don't want to include the .ctor section from
        the crtend.o file until after the sorted ctors.
        The .ctor section from the crtend file contains the
        end of ctors marker and it must be last */
 
-    KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
     KEEP (*(SORT(.ctors.*)))
     KEEP (*(.ctors))
     __CTOR_END = .; 
@@ -106,8 +101,9 @@ SECTIONS
   .dtor ALIGN(4) : 
   { 
     __DTOR_START = .; 
-    KEEP (*crtbegin*.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
     KEEP (*(SORT(.dtors.*)))
     KEEP (*(.dtors))
     __DTOR_END = .; 
@@ -133,21 +129,21 @@ SECTIONS
    The heap and stack are aligned to the bus width, as a speed optimization
    for accessing data located there.  */
 
-  .heap :
+  .heap (NOLOAD) :
   {
     . = ALIGN(4);
     __HEAP_START = .;
     . += 0x2000; __HEAP_MAX = .;
   } > ram
 
-  .stack :
+  .stack (NOLOAD) :
   {
     . = ALIGN(4);
     . += 0x6000;
     __STACK_START = .;
   } > ram
 
-  .istack :
+  .istack (NOLOAD) :
   {
     . = ALIGN(4);
     . += 0x100;