tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Patch to allow linking PIC-objects into static executable


From: tike64
Subject: [Tinycc-devel] Patch to allow linking PIC-objects into static executable
Date: Mon, 11 Dec 2006 02:09:06 -0800 (PST)

Hi,

Attached patch makes it possible to use PIC-objects, i.e. objects with
a GOT, in a non-dynamic executable. It is against latest cvs patched
with Daniel's gotoff32 patch:

http://lists.gnu.org/archive/html/tinycc-devel/2006-12/msg00016.html

Maybe someone could verify it and apply to cvs

--

tike


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
diff -rudw tinycc-gotoff32/tccelf.c tinycc/tccelf.c
--- tinycc-gotoff32/tccelf.c    2006-12-11 11:47:29.000000000 +0200
+++ tinycc/tccelf.c     2006-12-11 11:52:18.000000000 +0200
@@ -555,6 +555,10 @@
             break;
        case R_ARM_COPY:
             break;
+        case R_ARM_GLOB_DAT:
+        case R_ARM_JUMP_SLOT:
+            *(int *)ptr = val;
+            break;
        default:
            fprintf(stderr,"FIXME: handle reloc type %x at %lx [%.8x] to %lx\n",
                     type,addr,(unsigned int )ptr,val);
@@ -805,6 +809,10 @@
                       s1->got->data_offset,
                       reloc_type, index);
     }
+    else
+        put_elf_reloc(symtab_section, s1->got,
+                      s1->got->data_offset,
+                      reloc_type, sym_index);
     ptr = section_ptr_add(s1->got, sizeof(int));
     *ptr = 0;
 }
@@ -1600,7 +1608,7 @@
         /* XXX: ignore sections with allocated relocations ? */
         for(i = 1; i < s1->nb_sections; i++) {
             s = s1->sections[i];
-            if (s->reloc && s != s1->got)
+            if (s->reloc)
                 relocate_section(s1, s);
         }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]