Commits

ariovistus  committed a90d7b8

compiles under dmd 2.060!
scons isn't working out for me.

  • Participants
  • Parent commits 57fbde3

Comments (0)

Files changed (8)

File deimos/elfutils/libdw.d

 
 
 /* Type for offset in DWARF file.  */
-typedef GElf_Off Dwarf_Off;
+alias GElf_Off Dwarf_Off;
 
 /* Type for address in DWARF file.  */
-typedef GElf_Addr Dwarf_Addr;
+alias GElf_Addr Dwarf_Addr;
 
 /* Integer types.  Big enough to hold any numeric value.  */
-typedef GElf_Xword Dwarf_Word;
-typedef GElf_Sxword Dwarf_Sword;
+alias GElf_Xword Dwarf_Word;
+alias GElf_Sxword Dwarf_Sword;
 /* For the times we know we do not need that much.  */
-typedef GElf_Half Dwarf_Half;
+alias GElf_Half Dwarf_Half;
 
 struct Dwarf_Abbrev;
 

File deimos/gelf.d

 // fedora: elfutils-libelf-devel
 // license: gpl2
 
+pragma(lib, "elf");
+
 public import deimos.libelf;
 
 extern(C): 
        therefore all other classes can be represented without loss.  */
 
     /* Type for a 16-bit quantity.  */
-    typedef Elf64_Half GElf_Half;
+    alias Elf64_Half GElf_Half;
 
     /* Types for signed and unsigned 32-bit quantities.  */
-    typedef Elf64_Word GElf_Word;
-    typedef	Elf64_Sword GElf_Sword;
+    alias Elf64_Word GElf_Word;
+    alias	Elf64_Sword GElf_Sword;
 
     /* Types for signed and unsigned 64-bit quantities.  */
-    typedef Elf64_Xword GElf_Xword;
-    typedef	Elf64_Sxword GElf_Sxword;
+    alias Elf64_Xword GElf_Xword;
+    alias	Elf64_Sxword GElf_Sxword;
 
     /* Type of addresses.  */
-    typedef Elf64_Addr GElf_Addr;
+    alias Elf64_Addr GElf_Addr;
 
     /* Type of file offsets.  */
-    typedef Elf64_Off GElf_Off;
+    alias Elf64_Off GElf_Off;
 
 
     /* The ELF file header.  This appears at the start of every ELF file.  */
-    typedef Elf64_Ehdr GElf_Ehdr;
+    alias Elf64_Ehdr GElf_Ehdr;
 
     /* Section header.  */
-    typedef Elf64_Shdr GElf_Shdr;
+    alias Elf64_Shdr GElf_Shdr;
 
     /* Section index.  */
     /* XXX This should probably be a larger type in preparation of times when
        regular section indices can be larger.  */
-    typedef Elf64_Section GElf_Section;
+    alias Elf64_Section GElf_Section;
 
     /* Symbol table entry.  */
-    typedef Elf64_Sym GElf_Sym;
+    alias Elf64_Sym GElf_Sym;
 
     /* The syminfo section if available contains additional information about
        every dynamic symbol.  */
-    typedef Elf64_Syminfo GElf_Syminfo;
+    alias Elf64_Syminfo GElf_Syminfo;
 
     /* Relocation table entry without addend (in section of type SHT_REL).  */
-    typedef Elf64_Rel GElf_Rel;
+    alias Elf64_Rel GElf_Rel;
 
     /* Relocation table entry with addend (in section of type SHT_RELA).  */
-    typedef Elf64_Rela GElf_Rela;
+    alias Elf64_Rela GElf_Rela;
 
     /* Program segment header.  */
-    typedef Elf64_Phdr GElf_Phdr;
+    alias Elf64_Phdr GElf_Phdr;
 
     /* Dynamic section entry.  */
-    typedef Elf64_Dyn GElf_Dyn;
+    alias Elf64_Dyn GElf_Dyn;
 
 
     /* Version definition sections.  */
-    typedef Elf64_Verdef GElf_Verdef;
+    alias Elf64_Verdef GElf_Verdef;
 
     /* Auxialiary version information.  */
-    typedef Elf64_Verdaux GElf_Verdaux;
+    alias Elf64_Verdaux GElf_Verdaux;
 
     /* Version dependency section.  */
-    typedef Elf64_Verneed GElf_Verneed;
+    alias Elf64_Verneed GElf_Verneed;
 
     /* Auxiliary needed version information.  */
-    typedef Elf64_Vernaux GElf_Vernaux;
+    alias Elf64_Vernaux GElf_Vernaux;
 
 
     /* Type for version symbol information.  */
-    typedef Elf64_Versym GElf_Versym;
+    alias Elf64_Versym GElf_Versym;
 
 
     /* Auxiliary vector.  */
-    typedef Elf64_auxv_t GElf_auxv_t;
+    alias Elf64_auxv_t GElf_auxv_t;
 
 
     /* Note section contents.  */
-    typedef Elf64_Nhdr GElf_Nhdr;
+    alias Elf64_Nhdr GElf_Nhdr;
 
 
     /* Move structure.  */
-    typedef Elf64_Move GElf_Move;
+    alias Elf64_Move GElf_Move;
 
 
     /* Library list structure.  */
-    typedef Elf64_Lib GElf_Lib;
+    alias Elf64_Lib GElf_Lib;
 
 
     /+

File deimos/libelf.d

 public import core.sys.posix.sys.types;
 
 pragma(lib, "elf");
+extern(C):
 
 // fedora: elfutils-libelf-devel
 // license: gpl2
 /* Descriptor for ELF file section.  */
 struct Elf_Scn;
 
-extern(C):
 
 /* Return descriptor for ELF file to work according to CMD.  */
 Elf *elf_begin (int __fildes, Elf_Cmd __cmd, Elf *__ref);

File test/SConstruct

+env = Environment(
+    #DPATH = "../"
+)
+env_elf = Environment(
+    DPATH = "../",
+    DLINKFLAGS = ["-L-lelf"],
+)
+
+env_dw = Environment(
+    DPATH = "../",
+    DLINKFLAGS = ["-L-ldw"],
+)
+
+env.Program("gelf_test", Split("""
+        gelf_test.d
+        ../deimos/elf.d
+        ../deimos/gelf.d
+        ../deimos/libelf.d
+        """))
+#env.Program("libasm_test.d")
+#env.Program("libebl_test.d")
+#env.Program("libelf_test.d")
+#env.Program("libdw_test.d");

File test/gelf_test.d

 import std.stdio;
-import deimos.libelf;
+import std.array;
 import deimos.gelf;
-import replace;
 
 template print_field(string x){
-    enum print_field = 
-        Replace!(q{writefln(printfmt, "$x", ehdr.$x);}, "$x", x);
+    enum print_field = replace(q{writefln(printfmt, "$x", ehdr.$x);}, "$x", x);
 }
 void main(){
     assert(elf_version(EV_CURRENT) != EV_NONE, 
             "elf library initialization failed");
-    auto f = File("udis_test");
+    auto f = File("gelf_test");
     auto e = elf_begin(f.fileno(), Elf_Cmd.ELF_C_READ, null);
     assert(e);
     auto ek = elf_kind(e);

File test/libdw_test.d

+import deimos.elfutils.libdw;
+import deimos.elfutils.libdwfl;
+
+void main(){
+    dwfl_line_comp_dir (null);
+}

File test/libelf_test.d

 void main(){
     assert(elf_version(EV_CURRENT) != EV_NONE, 
             "elf library initialization failed");
-    auto f = File("udis_test");
+    auto f = File("libelf_test");
     auto e = elf_begin(f.fileno(), Elf_Cmd.ELF_C_READ, null);
     assert(e);
     auto ek = elf_kind(e);

File test/makefile

+ALLES = libelf_test gelf_test libasm_test libebl_test #libdw_test
+
+DC = dmd
+#DC = ldc2
+
+all: $(ALLES)
+
+clean: 
+	rm -f *.o $(ALLES)
+
+libelf_test: libelf_test.d ../deimos/libelf.d ../deimos/elf.d
+	dmd $^ -of$@ 
+
+libasm_test: libasm_test.d ../deimos/elfutils/*.d ../deimos/gelf.d ../deimos/libelf.d ../deimos/elf.d
+	dmd $^ -of$@ 
+
+libdw_test: libdw_test.d ../deimos/elfutils/*.d ../deimos/gelf.d ../deimos/libelf.d ../deimos/elf.d
+	dmd $^ -of$@  -L-ldw
+
+libebl_test: libasm_test.d ../deimos/elfutils/*.d ../deimos/gelf.d ../deimos/libelf.d ../deimos/elf.d
+	dmd $^ -of$@ 
+
+gelf_test: gelf_test.d ../deimos/libelf.d ../deimos/elf.d ../deimos/gelf.d ~/mercurial/blitter/src/replace.d
+	dmd $^ -of$@