Commit Graph

4352 Commits

Author SHA1 Message Date
Rafael Espindola
2494dfcf17 Add static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186170 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 16:29:27 +00:00
Benjamin Kramer
7172b38af7 llvm-ar: Clean up memory management with OwningPtr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186131 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 23:15:05 +00:00
Rafael Espindola
4d5b0da81b Use %llu to print a 64 bit number. Should fix the ARM bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186113 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 20:01:30 +00:00
Rafael Espindola
1b3e3eef1f InsertBefore is the same as AddBefore. Delete it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186094 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 15:54:53 +00:00
Rafael Espindola
71857ccdb8 Fix a FIXME about the format and add a test.
While at it, use strftime on Unix too and use the thread safe versions
of localtime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186090 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 15:35:23 +00:00
Rafael Espindola
1b0dc64919 Remove the 'N' modifier from llvm-ar.
* It is not present on OS X.
* It is untested.
* It is not needed for using ar in a build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186080 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 13:03:27 +00:00
Rafael Espindola
55804a089e Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186079 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 12:54:11 +00:00
Rafael Espindola
ab7348f8b1 Remove support for truncating names in archives.
* All systems we support have some form of long name support.
* The options has different names and semantics in different implementations
  ('f' on gnu, 'T' on OS X), which makes it unlikely it is normally used on
  build systems.
* It was completely untested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186078 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 12:38:02 +00:00
Rafael Espindola
4f2779b809 Sync llvm-ar's help string with the options it supports.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186076 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 12:28:36 +00:00
Rafael Espindola
5159718095 Don't crash in 'llvm -s' when an archive has no symtab.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186029 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-10 20:14:22 +00:00
Bill Wendling
c6fbaa9701 Don't run internalize if we're outputing bit-code and not an object file.
The problem with running internalize before we're ready to output an object file
is that it may change a 'weak' symbol into an internal one, but that symbol
could be needed by an external object file --- e.g. with arclite.

<rdar://problem/14334895>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185882 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 23:23:03 +00:00
Rafael Espindola
35637fc623 Create files with the correct permission instead of changing it afterwards.
No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185832 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 16:16:51 +00:00
Manuel Klimek
a012a66688 Fixes problem when calling llvm-ar from an unmodifiable directory.
This fixes a regression introduced by r185726: the new call to get
a unique file does not prepend the system temporary directory, so
we need to anchor on the file that the temporary file gets moved
to to ensure we're on the same file system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185825 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 14:44:57 +00:00
Benjamin Kramer
0bb8aa29d8 COFFDumper: Print uint64_t with the right format string.
I wish we could typecheck llvm::format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185766 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-06 20:01:46 +00:00
Michael Gottesman
2be430d251 [llvm-ar] Added llvm_unreachable to quiet -Wreturn-type warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185751 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-06 02:39:51 +00:00
Rafael Espindola
200c748a86 Add a createUniqueFile function and switch llvm's users of unique_file.
This function is complementary to createTemporaryFile. It handles the case were
the unique file is *not* temporary: we will rename it in the end. Since we
will rename it, the file has to be in the same filesystem as the final
destination and we don't prepend the system temporary directory.

This has a small semantic difference from unique_file: the default mode is 0666.
This matches the behavior of most unix tools. For example, with this change
lld now produces files with the same permissions as ld. I will add a test
of this change when I port clang over to createUniqueFile (next commit).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185726 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 21:01:08 +00:00
Rafael Espindola
1276b39613 Use sys::fs::createTemporaryFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 20:14:52 +00:00
Rafael Espindola
61de142984 Don't create an archive if, for example, we are asked to print the index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185697 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 13:03:07 +00:00
Rafael Espindola
ef2703a1fb Use simpler version of exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185695 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 12:44:49 +00:00
Rafael Espindola
87b8a7f999 Remove NoOperation.
parseCommandLine prints and error and exists if no operation is specified, so
it never returns NoOperation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185691 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 12:12:43 +00:00
Rafael Espindola
24663f69cc Don't treat bitcode files specially in llvm-ar.
We really want bitcode files to behave as regular object files in archives, so
we don't need to track that a member is bitcode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185681 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 04:19:32 +00:00
Rafael Espindola
40d40dd44e Make llvm-nm return 1 on error.
This is a small compatibility improvement with gnu nm and makes llvm-nm more
useful as a testing tool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185546 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-03 15:46:03 +00:00
Rafael Espindola
a3863ea2da Remove address spaces from MC.
This is dead code since PIC16 was removed in 2010. The result was an odd mix,
where some parts would carefully pass it along and others would assert it was
zero (most of the object streamer for example).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185436 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 15:49:13 +00:00
NAKAMURA Takumi
d212db0cac llvm-symbolizer: Recognize a drive letter on win32. Then "REQUIRES: shell" can be removed.
FIXME: Could we use llvm::sys::Path here?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185322 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01 09:51:42 +00:00
Sylvestre Ledru
ba62f2f1bf The build system is currently miss-identifying GNU/kFreeBSD as FreeBSD.
This kind of simplification is sometimes useful, but in general it's not correct. 

As GNU/kFreeBSD is an hybrid system, for kernel-related issues we want to match the
build definitions used for FreeBSD, whereas for userland-related issues we want to
match the definitions used for other systems with Glibc.

The current modification adjusts the build system so that they can be distinguished,
and explicitly adds GNU/kFreeBSD to the build checks in which it belongs.

Fixes bug #16444.

Patch by Robert Millan in the context of Debian.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185311 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01 08:07:52 +00:00
Daniel Malea
e16e687034 Add flag to lli to enable debugging of IR when used with MCJIT.
- warn users when -debug-ir is used with old JIT engine (only partial debug
  info is available) 

For example, to debug an IR file with GDB (that supports JIT registration), do:

$ gdb --args lli -use-mcjit -debug-ir testcase.ll
(gdb) break main
(gdb) run
<Process continues to lli main>
(gdb) continue
<Process continues to testcase.ll main()
(gdb) step
<Now stepping through the LLVM IR in testcase.ll>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185197 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 19:11:40 +00:00
Hal Finkel
e528a2c21a Fix bugpoint execution/reference output file name
sys::fs::unique_file will now loop infinitely if provided with a file name
without '%' characters and the input file already exists. As a result, bugpoint
cannot use a fixed file name for the execution output (including the reference
output).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185166 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 16:37:52 +00:00
Alexey Samsonov
0ed872cdd1 llvm-symbolizer: don't leave dangling pointers after flushing LLVMSymbolizer. Add a destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185154 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 15:08:29 +00:00
Alexey Samsonov
8c6e3248e9 llvm-symbolizer: skip leading underscore in Mach-O symbol table entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185151 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 14:25:52 +00:00
Alexey Samsonov
c071f89a77 llvm-symbolizer: make name demangling a public static method of LLVMSymbolizer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185143 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 12:06:25 +00:00
Alexey Samsonov
8175bc3d3b llvm-symbolizer: add support for Mach-O universal binaries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185137 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 08:15:40 +00:00
Manman Ren
cbafae6d33 Debug Info: clean up usage of Verify.
No functionality change.
It should suffice to check the type of a debug info metadata, instead of
calling Verify. For cases where we know the type of a DI metadata, use
assert.

Also update testing cases to make them conform to the format of DI classes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 05:43:10 +00:00
Eric Christopher
8479989ebe Revert "Debug Info: clean up usage of Verify." as it's breaking bots.
This reverts commit r185020

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185032 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 22:44:57 +00:00
Manman Ren
02e75021d8 Debug Info: clean up usage of Verify.
No functionality change.
It should suffice to check the type of a debug info metadata, instead of
calling Verify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185020 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 21:26:10 +00:00
Rafael Espindola
97c2a0a110 Use enums instead of raw octal values.
Patch by 罗勇刚(Yonggang Luo).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184971 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 17:28:04 +00:00
Rafael Espindola
df0f525cc4 Remove unused includes.
llvm itself is now PathV1 clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184947 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 13:54:34 +00:00
Andy Gibbs
0259c0cde5 Provide bootstrap support to build only llvm+clang when using cmake.
Where a source tree is complete with lld, lldb and polly, it may not be possible to use cmake to configure build scripts if the host compiler it not capable of compiling these sub-projects.  This change makes it possible to first build a bootstrap clang compiler when can then be used to build a complete llvm toolchain.  An example bootstrap build sequence could be as follows:

$ mkdir bootstrap
$ cd bootstrap
$ cmake -G 'Unix Makefiles'
        -DCMAKE_BUILD_TYPE:STRING=Release
        -DCMAKE_PREFIX_PATH:STRING=$(pwd)
        -DLLVM_TARGETS_TO_BUILD:STRING=host
        -DLLVM_INCLUDE_TOOLS:STRING=bootstrap-only
        ../source
$ make clang  # build clang only for host

$ cd ..
$ export CC=$(realpath bootstrap/bin)/clang
$ export CXX=$(realpath bootstrap/bin)/clang++

$ mkdir final
$ cd final
$ cmake -G 'Unix Makefiles' ../source
$ make all check-all


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184924 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 08:05:08 +00:00
Rafael Espindola
50188c1f42 Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184914 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:01:35 +00:00
Rafael Espindola
46fa7cf91a Move GetEXESuffix to the one place it is used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184853 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-25 14:42:30 +00:00
Rafael Espindola
dd5af27a74 keep only the StringRef version of getFileOrSTDIN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184826 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-25 05:28:34 +00:00
Rafael Espindola
19ead5a9f1 Create the file with the right permissions instead of setting it afterwards.
Removes the last use of PathV1.h in llvm-ar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184630 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-22 02:34:24 +00:00
Sean Silva
068463b714 [yaml2obj][ELF] Make symbol table top-level key.
Although in reality the symbol table in ELF resides in a section, the
standard requires that there be no more than one SHT_SYMTAB. To enforce
this constraint, it is cleaner to group all the symbols under a
top-level `Symbols` key on the object file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-22 01:38:00 +00:00
Sean Silva
681dafbb6c [yaml2obj][ELF] Narrow parameter.
The full ELFYAML::Section isn't needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184626 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-22 01:37:55 +00:00
Sean Silva
58495694c0 [yaml2obj][ELF] Don't special case writing these.
Just add them to the vector of section headers like the rest of the
section headers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184624 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-22 01:06:12 +00:00
Sean Silva
efc78986b3 [yaml2obj][ELF] Make this "type switch" actually readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-22 01:03:35 +00:00
Sean Silva
e766884193 [yaml2obj][ELF] Align section contents in the output.
The improperly aligned section content in the output was causing
buildbot failures. This should fix them.

Incidentally, this results in a simpler and more robust API for
ContiguousBlobAccumulator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-22 00:47:43 +00:00
Rafael Espindola
995017caf9 Convert some uses of PathV1.h in ArchiveWriter.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184599 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 22:11:36 +00:00
Sean Silva
326c193e0a [yaml2obj][ELF] Allow expressing undefined symbols.
Previously we unconditionally enforced that section references in
symbols in the YAML had a name that was a section name present in the
object, and linked the references to that section. Now, permit empty
section names (already the default, if the `Section` key is not
provided) to indicate SHN_UNDEF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184513 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 01:11:48 +00:00
Sean Silva
552d7cd31a Unbreak bots. Didn't realize this was a C++11 feature.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184508 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 00:33:01 +00:00
Sean Silva
4235ba32f2 [yaml2obj][ELF] Don't explicitly set Binding with STB_*
Instead, just have 3 sub-lists, one for each of
{STB_LOCAL,STB_GLOBAL,STB_WEAK}.

This allows us to be a lot more explicit w.r.t. the symbol ordering in
the object file, because if we allowed explicitly setting the STB_*
`Binding` key for the symbol, then we might have ended up having to
shuffle STB_LOCAL symbols to the front of the list, which is likely to
cause confusion and potential for error.

Also, this new approach is simpler ;)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184506 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 00:27:50 +00:00