Commit Graph

4188 Commits

Author SHA1 Message Date
Sean Silva 6b08388940 [yaml2obj][ELF] Rudimentary symbol table support.
Currently, we only output the name.

llvm-svn: 184255
2013-06-18 23:14:03 +00:00
Sean Silva c3131926c0 [yaml2obj][ELF] Add dummy .strtab section.
This will be needed later for holding symbol names, due to the libObject
issue mentioned in the commit message of r184161.

llvm-svn: 184242
2013-06-18 21:37:50 +00:00
Rafael Espindola 8ffbac96a8 Convert most uses of PathV1.h in ToolRunner.cpp.
llvm-svn: 184210
2013-06-18 17:20:08 +00:00
Rafael Espindola 4526b1d410 Add a version of unique_file that return just the file name.
llvm-svn: 184206
2013-06-18 17:01:00 +00:00
Rafael Espindola c724765d52 Return a std::string from PrependMainExecutablePath.
llvm-svn: 184204
2013-06-18 16:47:55 +00:00
Rafael Espindola 319d9752ee Remove PathV1.h use from BugDriver.cpp.
llvm-svn: 184203
2013-06-18 16:21:54 +00:00
Rafael Espindola becba2bcff Remove use of PathV1.h from ExecutionDriver.cpp.
llvm-svn: 184202
2013-06-18 16:14:09 +00:00
Rafael Espindola 7b349ced31 Remove usage of PathV1.h from OptimizerDriver.cpp.
llvm-svn: 184198
2013-06-18 15:54:13 +00:00
Rafael Espindola 75d8fa51c9 Convert some uses of eraseFromDisk.
llvm-svn: 184196
2013-06-18 15:33:18 +00:00
Rafael Espindola 302c0da6f1 Don't use PathV1.h in tools/bugpoint/Miscompilation.cpp.
llvm-svn: 184193
2013-06-18 15:29:32 +00:00
Alexey Samsonov e6388e622e Basic support for parsing Mach-O universal binaries in LLVMObject library
llvm-svn: 184191
2013-06-18 15:03:28 +00:00
Bill Wendling bc07a8900c Use pointers to the MCAsmInfo and MCRegInfo.
Someone may want to do something crazy, like replace these objects if they
change or something.

No functionality change intended.

llvm-svn: 184175
2013-06-18 07:20:20 +00:00
Sean Silva 85d3eeb6e7 [yaml2obj][ELF] Factor out string table section creation.
llvm-svn: 184162
2013-06-18 01:11:27 +00:00
Sean Silva fde4ab0fc8 [yaml2obj][ELF] Refer specifically to the section header string table.
A bug in libObject will cause it to assert() if a symbol table's string
table and the section header string table are the same section, so we
need to ensure that we emit two different string tables (among other
things). The problematic code is the hardcoded usage of ".strtab"
(`dot_strtab_sec`) for looking up symbol names in
ELFObjectFile<ELFT>::getSymbolName.

I discussed this with Michael, and he has some local improvements to the
ELF code in libObject that, among other things, should fix our handling
of this scenario.

llvm-svn: 184161
2013-06-18 01:11:24 +00:00
Sean Silva f62a6005f3 [yaml2obj][ELF] Ensure more fields are zero'd.
I was spotting garbage in the output. I'd like to just zero the entire
ELFYAML::Section to be sure, but it contains non-POD types. (I'm also
trying to avoid bloating the ELFYAML::Foo classes with a bunch of
constructor code).

No test, since this is by its very nature unpredictable. I'm pretty sure
that one of the sanitizers would catch it immediately though.

llvm-svn: 184160
2013-06-18 01:11:21 +00:00
Rafael Espindola d9a5608dd7 Fix the build with gcc 4.7 and -std=c++11.
The error message was:

/home/espindola/llvm/llvm/tools/gold/gold-plugin.cpp: In function ‘ld_plugin_status cleanup_hook()’:
/home/espindola/llvm/llvm/tools/gold/gold-plugin.cpp:461:30: error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string<char>}’ through ‘...’

I will check if this was a clang or gcc issue.

llvm-svn: 184138
2013-06-17 22:24:06 +00:00
Rafael Espindola 180795863d Convert two uses of eraseFromDisk.
llvm-svn: 184136
2013-06-17 21:50:28 +00:00
Rafael Espindola 6ce17a4c52 Remove usage of PathV1.h in FindBugs.cpp.
llvm-svn: 184122
2013-06-17 20:48:36 +00:00
Sean Silva 415d93fab5 [yaml2obj][ELF] Exit with error status on error.
llvm-svn: 184115
2013-06-17 20:14:59 +00:00
Rafael Espindola bb87665475 Don't use PathV1.h in CrashDebugger.cpp.
llvm-svn: 184109
2013-06-17 19:33:18 +00:00
Rafael Espindola 34889cabcd Don't use PathV1.h in ToolRunner.h.
llvm-svn: 184107
2013-06-17 19:21:38 +00:00
Rafael Espindola 4b226bd403 Remove CBE related code.
llvm-svn: 184106
2013-06-17 19:03:02 +00:00
Rafael Espindola 7e936eee25 Don't use PathV1.h in ExtractFunction.cpp.
llvm-svn: 184102
2013-06-17 18:48:59 +00:00
Rafael Espindola 55ab87f151 Don't use PathV1.h in tools/gold/gold-plugin.cpp.
llvm-svn: 184099
2013-06-17 18:38:18 +00:00
Rafael Espindola 40c908bfad Don't use PathV1.h in LTOCodeGenerator.cpp
This patch also adds a simpler version of sys::fs::remove and a tool_output_file
constructor for when we already have an open file.

llvm-svn: 184095
2013-06-17 18:05:35 +00:00
Rafael Espindola f1f1273682 Don't use PathV1.h in llvm-link.
llvm-svn: 184092
2013-06-17 17:32:19 +00:00
Rafael Espindola ac5c1b0d68 Move lib/Archive to tools/llvm-ar.
llvm-ar is the only tool that needs to write archive files. Every other tool
should be able to use the lib/Object interface.

llvm-svn: 184083
2013-06-17 15:47:20 +00:00
Rafael Espindola 28c2e33362 Don't link with the archive library programs that don't use it.
llvm-svn: 184081
2013-06-17 15:29:46 +00:00
Sean Silva 2a74f708bc [yaml2obj] Move some classes into anonymous namespaces.
llvm-svn: 184025
2013-06-15 00:31:46 +00:00
Sean Silva a6423eb8be [yaml2obj] Add support for sh_link via `Link` key.
llvm-svn: 184022
2013-06-15 00:25:26 +00:00
Rafael Espindola 668c642830 Remove the LLVM specific archive index.
Archive files (.a) can have a symbol table indicating which object
files in them define which symbols. The purpose of this symbol table
is to speed up linking by allowing the linker the read only the .o
files it is actually going to use instead of having to parse every
object's symbol table.

LLVM's archive library currently supports a LLVM specific format for
such table. It is hard to see any value in that now that llvm-ld is
gone:

* System linkers don't use it: GNU ar uses the same plugin as the
linker to create archive files with a regular index. The OS X ar
creates no symbol table for IL files, I assume the linker just parses
all IL files.

* It doesn't interact well with archives having both IL and native objects.

* We probably don't want to be responsible for yet another archive
format variant.

This patch then:

* Removes support for creating and reading such index from lib/Archive.
* Remove llvm-ranlib, since there is nothing left for it to do.

We should in the future add support for regular indexes to llvm-ar for
both native and IL objects. When we do that, llvm-ranlib should be
reimplemented as a symlink to llvm-ar, as it is equivalent to "ar s".

llvm-svn: 184019
2013-06-14 23:25:53 +00:00
Rafael Espindola b786304fea Move PrependMainExecutablePath next to its only user.
llvm-svn: 183980
2013-06-14 15:12:13 +00:00
Rafael Espindola 7c42e7f409 Remove unused header.
llvm-svn: 183968
2013-06-14 04:31:19 +00:00
Sean Silva 0a409cf04a [yaml2obj] Add support for sh_addralign via `AddressAlign` key.
For consistency, change the address in the test case from 0xDEADBEEF to
0xCAFEBABE since 0xCAFEBABE that actually has a 2-byte alignment.

llvm-svn: 183962
2013-06-14 00:38:02 +00:00
Sean Silva 46dffffb39 [yaml2obj] Add support for specifying raw section content.
llvm-svn: 183955
2013-06-13 22:20:01 +00:00
Sean Silva f4bfcedfe5 [yaml2obj] Add sh_addr via `Address` key.
llvm-svn: 183954
2013-06-13 22:19:54 +00:00
Sean Silva 3820593160 [yaml2obj] Initial ELF section support.
The current functionality is extremely basic and a bit rough around the
edges, but it will flesh out in future commits.

llvm-svn: 183953
2013-06-13 22:19:48 +00:00
Rafael Espindola 4f35da77a6 Don't use PathV1.h in Signals.h.
llvm-svn: 183947
2013-06-13 21:16:58 +00:00
Rafael Espindola 280e5cb653 Don't use PathV1.h in FileUtilities.h.
llvm-svn: 183941
2013-06-13 20:41:00 +00:00
Rafael Espindola 7c1023ad27 Avoid using PathV1.h in Program.h.
llvm-svn: 183940
2013-06-13 20:25:38 +00:00
Rafael Espindola 4c7ad8fc27 Have sys::FindProgramByName return a std::string.
llvm-svn: 183928
2013-06-13 19:25:37 +00:00
Rafael Espindola e7a629fb33 Further reduce usage of sys::Path in bugpoint.
llvm-svn: 183912
2013-06-13 16:22:26 +00:00
Rafael Espindola c0bbe36245 Try to fix the build with libstdc++ 4.4.
llvm-svn: 183909
2013-06-13 15:52:54 +00:00
Rafael Espindola b851d42f47 Reduce sys::Path usage in bugpoint.
llvm-svn: 183908
2013-06-13 15:47:11 +00:00
Rafael Espindola cb2eca0f91 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

llvm-svn: 183864
2013-06-12 20:58:35 +00:00
Rui Ueyama 82ebd8e36d readobj: Dump PE/COFF optional records.
These records are mandatory for executables and are used by the loader.

Reviewers: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D939

llvm-svn: 183852
2013-06-12 19:10:33 +00:00
Rafael Espindola 71affba988 Inline Path::isBitcodeFile into only use and remove it.
llvm-svn: 183840
2013-06-12 15:13:57 +00:00
Rafael Espindola d1fcac9126 Include PathV1.h in files that use it.
This is preparation for replacing Path.h with PathV2.h.

llvm-svn: 183782
2013-06-11 20:00:56 +00:00
Rafael Espindola 46ed353313 Convert another use of sys::identifyFileType.
No functionality change.

llvm-svn: 183759
2013-06-11 18:05:26 +00:00
Sean Silva 864dd75093 Fix dubious type name similar to member name.
Should bring bots back to life.

llvm-svn: 183715
2013-06-11 00:13:52 +00:00