Hi all,
Attached is an initial implementation of a 64-bit ELF object file
reader. It is based on the existing 32-bit reader.
This patch allows disassemble to work on x86_64 linux. Support for
dependent modules is included, though LLDB still needs to be taught how
to resolve shared objects on linux (currently works only when the .so is
in the working directory).
Planed work includes renaming the existing 32 bit reader from
ObjectFileELF to ObjectFileELF32, extend with features from the 64 bit
version, and create a base class containing common functionality.
Any feedback greatly appreciated!
Take care,
Steve
elf64-2010-07-06.patch (48.7 KB)
One good first step would be to get rid of the local elf.h and start
using llvm/Support/ELF.h.
+ bool have_32bit = magic[EI_CLASS] == 1;
Magic "1" is bad; use ELFCLASS32 (which is in the LLVM ELF.h).
Can you make the diff for ObjectFileELF64.cpp on top of an "svn cp"?
It's difficult to review otherwise.
-Eli
Hi Eli,
Eli Friedman <eli.friedman@gmail.com> writes:
One good first step would be to get rid of the local elf.h and start
using llvm/Support/ELF.h.
I think that is ideal, but there is lack of 64 bit support in that
header. I can work on a patch for it.
+ bool have_32bit = magic[EI_CLASS] == 1;
Magic "1" is bad; use ELFCLASS32 (which is in the LLVM ELF.h).
OK. Will update local elf.h in next iteration to remove the constant.
Can you make the diff for ObjectFileELF64.cpp on top of an "svn cp"?
It's difficult to review otherwise.
I originally wrote the file using llvm coding standards, then
reformatted when it was made clear to me LLDB will follow its own
standards. Unfortunately a `diff -Naur ObjectFileELF.cpp
ObjectFileELF64.cpp` is not a very good result for review. Will
reformat tomorrow so as to be more true to the original file and post
again.
Thanks!
Steve
Hi Eli,
Eli Friedman <eli.friedman@gmail.com> writes:
Magic "1" is bad; use ELFCLASS32 (which is in the LLVM ELF.h).
OK. Updated local elf.h with the constant. Updating llvm's ELF.h so we
can use it is on my todo list.
Can you make the diff for ObjectFileELF64.cpp on top of an "svn cp"?
It's difficult to review otherwise.
Attached is an updated patch set attempting to minimize changes between
the 32 and 64 bit versions, and two diffs comparing the original and new
code.
Minor style differences between the two is an attempt to remain within
80 columns, and a preference for function application/declaration in the
form "foo()" instead of with a space "foo ()" (I see both styles used in
the code base. If there is a preference and I made the wrong choice I
will be happy to fix it).
Thanks!
Steve
elf64-2010-07-07.patch (51 KB)
ObjectFileELF64.h.diff (7.93 KB)
ObjectFileELF64.cpp.diff (46.6 KB)
Your patch was committed.
There appear to be some interesting enhancements/bug-fixes in the
ELF-64 code compared to the ELF-32 code; would you mind writing a
cleanup patch for the ELF-32 code?
-Eli
Eli Friedman <eli.friedman@gmail.com> writes: