Ugly section alignment fix
authornorly <ny-git@enpas.org>
Mon, 28 Jan 2013 02:21:35 +0000 (02:21 +0000)
committernorly <ny-git@enpas.org>
Mon, 11 Feb 2013 01:32:32 +0000 (01:32 +0000)
...until I figure out how to align entire sections.

The program runs, but the sections are slightly moved around and thus
the entry point cannot be right.

Seems this is because libelf loses some dynamic symbols (???)

src/copy/section.c

index 5a62593642e9c2ba2ac2662869f66be24751b6c6..e096b2b7140999c5185a034e9413fcacefe2ed3d 100644 (file)
@@ -57,7 +57,8 @@ void elfu_copySection(Elf *eo, Elf_Scn *scn)
       fprintf(stderr, "elf_newdata() failed: %s\n", elf_errmsg(-1));
     }
 
-    dataOut->d_align = data->d_align;
+    //dataOut->d_align = data->d_align;
+    dataOut->d_align = shdr.sh_addralign;
     dataOut->d_buf  = data->d_buf;
     /* dataOut->d_off  = data->d_off; */
     dataOut->d_type = data->d_type;