Add startswith function and use it instead of CONST_STRNEQ.
[deliverable/binutils-gdb.git] / ld / emultempl / beos.em
index bb4395f63ae964e5e71333cc4629417af770d799..d984d3dd198884e392ee6a7a411d930c043c591a 100644 (file)
@@ -461,8 +461,8 @@ sort_by_section_name (const void *a, const void *b)
      FIXME stripping images with a .rsrc section still needs to be fixed.  */
   if (i != 0)
     {
-      if ((CONST_STRNEQ (sna, ".stab"))
-         && (!CONST_STRNEQ (snb, ".stab")))
+      if ((startswith (sna, ".stab"))
+         && (!startswith (snb, ".stab")))
        return 1;
     }
   return i;
@@ -536,7 +536,7 @@ sort_sections (lang_statement_union_type *s)
            {
              /* Is this the .idata section?  */
              if (sec->spec.name != NULL
-                 && CONST_STRNEQ (sec->spec.name, ".idata"))
+                 && startswith (sec->spec.name, ".idata"))
                {
                  /* Sort the children.  We want to sort any objects in
                     the same archive.  In order to handle the case of
@@ -712,7 +712,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
 static char *
 gld_${EMULATION_NAME}_get_script (int *isfile)
 EOF
+
+if test x"$COMPILE_IN" = xyes
+then
 # Scripts compiled in.
+
 # sed commands to quote an ld script as a C string.
 sc="-f stringify.sed"
 
@@ -734,6 +738,27 @@ echo '  ; else return'                                 >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.x                  >> e${EMULATION_NAME}.c
 echo '; }'                                             >> e${EMULATION_NAME}.c
 
+else
+# Scripts read from the filesystem.
+
+fragment <<EOF
+{
+  *isfile = 1;
+
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
+    return "ldscripts/${EMULATION_NAME}.xu";
+  else if (bfd_link_relocatable (&link_info))
+    return "ldscripts/${EMULATION_NAME}.xr";
+  else if (!config.text_read_only)
+    return "ldscripts/${EMULATION_NAME}.xbn";
+  else if (!config.magic_demand_paged)
+    return "ldscripts/${EMULATION_NAME}.xn";
+  else
+    return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+fi
+
 fragment <<EOF
 
 
This page took 0.025437 seconds and 4 git commands to generate.