]> git.wh0rd.org - ICEs.git/blobdiff - bfin-text-sect-attrs/ldso.i
more
[ICEs.git] / bfin-text-sect-attrs / ldso.i
diff --git a/bfin-text-sect-attrs/ldso.i b/bfin-text-sect-attrs/ldso.i
new file mode 100644 (file)
index 0000000..f6ff13a
--- /dev/null
@@ -0,0 +1,37 @@
+typedef unsigned int uint32_t;
+typedef uint32_t Elf32_Addr;
+typedef struct {
+       unsigned char e_ident[(16)];
+} Elf32_Ehdr;
+typedef struct {
+} Elf32_Dyn;
+static void
+    __attribute__ ((used)) _dl_start(Elf32_Addr dl_boot_got_pointer,
+                                    struct elf32_fdpic_loadmap
+                                    *dl_boot_progmap,
+                                    struct elf32_fdpic_loadmap
+                                    *dl_boot_ldsomap,
+                                    Elf32_Dyn * dl_boot_ldso_dyn_pointer,
+                                    struct funcdesc_value *dl_main_funcdesc,
+                                    unsigned long args)
+{
+       Elf32_Ehdr *header;
+       uint32_t *p32;
+       if (!header || header->e_ident[4] != 1 || header->e_ident[6] != 1
+           || *(p32 =
+                (uint32_t *) & header->e_ident) !=
+           ((uint32_t) (0x7f + 0x100 * ('E' + (0x100 * ('L' + 0x100 * 'F'))))))
+       {
+               do {
+                       static const char
+                           __attribute__ ((section(".text"))) __s[] =
+                           ("Invalid ELF header\n");
+                       {
+                               int __t;
+                               for (__t = 0; __t < 0x1000000; __t++)
+                                       __asm__ __volatile__("");
+                       }
+               }
+               while (0);
+       }
+}