Commit Graph

161 Commits

Author SHA1 Message Date
Ahmed Bougacha 4020363746 MC CFG: Remap enough for data too, analoguous to r188873.
llvm-svn: 188925
2013-08-21 19:40:28 +00:00
Ahmed Bougacha cc5cbd316d Add testcase for r188873: MCTextAtom boundaries.
Check that they are correctly computed if the last instruction is
larger than 1 byte.

llvm-svn: 188923
2013-08-21 19:40:22 +00:00
Ahmed Bougacha d56f705d87 Add basic YAML MC CFG testcase.
Drive-by llvm-objdump cleanup (don't hardcode ToolName).

llvm-svn: 188904
2013-08-21 16:13:25 +00:00
Ahmed Bougacha ffeecb5c80 MC: ObjectSymbolizer can now recognize external function stubs.
Only implemented in the Mach-O ObjectSymbolizer.
The testcase sadly introduces a new binary.

llvm-svn: 188879
2013-08-21 07:28:13 +00:00
Daniel Dunbar 9efbedfd35 [tests] Cleanup initialization of test suffixes.
- Instead of setting the suffixes in a bunch of places, just set one master
   list in the top-level config. We now only modify the suffix list in a few
   suites that have one particular unique suffix (.ml, .mc, .yaml, .td, .py).

 - Aside from removing the need for a bunch of lit.local.cfg files, this enables
   4 tests that were inadvertently being skipped (one in
   Transforms/BranchFolding, a .s file each in DebugInfo/AArch64 and
   CodeGen/PowerPC, and one in CodeGen/SI which is now failing and has been
   XFAILED).

 - This commit also fixes a bunch of config files to use config.root instead of
   older copy-pasted code.

llvm-svn: 188513
2013-08-16 00:37:11 +00:00
Michael J. Spencer 126973ba93 [Object] Split the ELF interface into 3 parts.
* ELFTypes.h contains template magic for defining types based on endianess, size, and alignment.
* ELFFile.h defines the ELFFile class which provides low level ELF specific access.
* ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface.

llvm-svn: 188022
2013-08-08 22:27:13 +00:00
Rafael Espindola b6b5f52ee8 Add support for the 's' operation to llvm-ar.
If no other operation is specified, 's' becomes an operation instead of an
modifier. The s operation just creates a symbol table. It is the same as
running ranlib.

We assume the archive was created by a sane ar (like llvm-ar or gnu ar) and
if the symbol table is present, then it is current. We use that to optimize
the most common case: a broken build system that thinks it has to run ranlib.

llvm-svn: 187353
2013-07-29 12:40:31 +00:00
Rafael Espindola ce7f52db48 Add an initial implementation of archive symbol table generation.
The symbol table has forward references in the file. Instead of allocating
a temporary buffer or counting the size and then writing, this implementation
writes a dummy value first and patches it once the final value is known.

There is room for performance improvement. I will implement them as soon as I
get some other features (like a ranlib mode) in.

llvm-svn: 186934
2013-07-23 10:47:01 +00:00
Rafael Espindola 0d6b347fa5 Mark ELF's first symbol as format specific so that llvm-nm ignores it.
llvm-svn: 186860
2013-07-22 19:24:34 +00:00
Rafael Espindola 623c3d8489 Replace archive members in the old position.
This matches gnu archive behavior and since archive member order can change
which member is used, not changing the order on replacement looks like the
right thing to do.

This patch also refactors the logic for which archive member to keep and
whether to move it to a helper function (computeInsertAction). The
nesting in computeNewArchiveMembers was getting a bit confusing.

llvm-svn: 186829
2013-07-22 15:11:51 +00:00
Rafael Espindola 9cea44a5f2 Don't depend on a llvm-ar specific behavior.
GNU ar when not given the a or b modifiers replaces archive members in the
same location of the old ones. I am about to implement that in llvm-ar. For
now, just don't depend on the current llvm-ar behavior on this test.

llvm-svn: 186823
2013-07-22 12:41:04 +00:00
Rafael Espindola 9cd2435b9a Handle replacement into a position past the original member.
We were incorrectly computing where to insert a member if it was replacing
a previous member that was before the insert point.

llvm-svn: 186792
2013-07-21 12:58:07 +00:00
Rafael Espindola fcc3a1a93f Fix inserting new elements in a specified location.
We were only handling the 'a' and 'b' options during moves before.

llvm-svn: 186721
2013-07-19 21:23:28 +00:00
Rafael Espindola 67080cec25 Split openFileForWrite into windows and unix versions.
It is similar to 186511, but for creating files for writing.

llvm-svn: 186679
2013-07-19 15:02:03 +00:00
Rafael Espindola a0d9b6b693 Split openFileForRead into Windows and Unix versions.
This has some advantages:

* Lets us use native, utf16 windows functions.
* Easy to produce good errors on windows about trying to use a
directory when we want a file.
* Simplifies the unix version a bit.

llvm-svn: 186511
2013-07-17 14:58:25 +00:00
NAKAMURA Takumi 212c80ac5d raw_ostream.cpp: Introduce <fcntl.h> to let O_BINARY provided. Or, llvm::outs() would be set to O_TEXT by default.
llvm/test/Object/check_binary_output.ll is expected to pass on win32.

llvm-svn: 186480
2013-07-17 02:21:10 +00:00
NAKAMURA Takumi 86bae2c54d llvm/test/Object/ar-create.test: Relax a CHECK line to satisfy localized message catalogue.
For example, 'No such file or directory' cannot be seen on Japanese version of msvcrt.

llvm-svn: 186469
2013-07-16 23:17:22 +00:00
NAKAMURA Takumi c398315043 llvm/test/Object/check_binary_output.ll: Mark it as XFAIL on Windows. Investigating.
llvm-svn: 186468
2013-07-16 23:16:57 +00:00
Rafael Espindola 7303af37b7 On error, close the temporary file descriptor.
With this change llvm-ar can remove the temporary file on windows too.

llvm-svn: 186423
2013-07-16 16:00:32 +00:00
NAKAMURA Takumi 07bc8e9b8e llvm/test/Object/directory.ll: Mark it as XFAIL:cygwin. Directories can be opened on cygwin.
llvm-svn: 186387
2013-07-16 09:06:47 +00:00
NAKAMURA Takumi 59f3ff8c41 Fix TimeValue::toWin32Time() to be symmetric to fromWin32Time() and compatible to Win32's FILETIME.
llvm-ar is the only user of toWin32Time() (via setLastModificationAndAccessTime), and r186298 can be reverted.
It had been buggy since the initial commit.

FIXME: Could we rename {from|to}Win32Time as {from|to}Win32FILETIME in TimeValue?
llvm-svn: 186374
2013-07-16 02:43:51 +00:00
Rafael Espindola f85d3ab7f8 Add mingw32 to the XFAIL. I forgot about it when adding win32.
llvm-svn: 186365
2013-07-15 23:51:47 +00:00
Rafael Espindola 54b71fdee2 XFAIL on windows too and document the XFAILs.
llvm-svn: 186354
2013-07-15 22:16:53 +00:00
Rafael Espindola 69d2271871 XFAIL this on freebsd to bring the bot back.
Joerg Sonnenberger tells me one can open a directory in freebsd. I will try
to centralize our calls to open so that we can handle O_BINARY in one place,
and will then handle this there too.

llvm-svn: 186317
2013-07-15 12:18:30 +00:00
NAKAMURA Takumi 7a12961bba Mark llvm/test/Object/extract.ll as XFAIL:mingw32, for now.
FIXME: Investigate Win32's TimeValue stuff!
llvm-svn: 186298
2013-07-15 03:04:13 +00:00
Chandler Carruth ba310c4bde The archive update test has a subtle race condition in it: if the test
is executed within the same second as the inputs for the test are
checked out from the source tree, it will fail to update due to being
below the resolution of the 'mtime' test used.

Now, this may seem improbably to you... ok, maybe *really* improbable,
but consider a system which does distributed execution of tests by
shipping their inputs to another machine and runs them. That might cause
the mtime to be quite recent during the test run. ;]

Instead, create two files directly in the test (allowing all platforms
to see the problem) and add either a use of the 'touch' command that
forces one mtime to some time quite a bit in the past, or it sleeps for
just over a second to be outside of the precision window.

llvm-svn: 186282
2013-07-14 10:46:51 +00:00
Benjamin Kramer c74fcc9972 Only verify the length in archive test, we can't make assumptions on the spacing.
And .* did just match about anything anyways.

llvm-svn: 186246
2013-07-13 15:21:39 +00:00
Rafael Espindola 0aac01b2f6 Add r186216 back, but make the test tolerant of different uids and gids.
original message:
Fix a off by one error about which members need to use the string table.

llvm-svn: 186238
2013-07-13 04:14:13 +00:00
Chandler Carruth fa74085f60 Revert commit r186216 -- it's breaking bots:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/6897/steps/check-all/logs/LLVM%3A%3Aarchive-format.test

Original commit log:
  Fix a off by one error about which members need to use the string
  table.

llvm-svn: 186232
2013-07-13 00:42:56 +00:00
Rafael Espindola bc63134afd Fix a off by one error about which members need to use the string table.
llvm-svn: 186216
2013-07-12 22:22:34 +00:00
Rafael Espindola 04397c1e9c Change archive-update.test to create a new file on the fly.
llvm-svn: 186206
2013-07-12 21:17:17 +00:00
Rafael Espindola 554eaad04e Rename directory to avoid problems on windows.
llvm-svn: 186202
2013-07-12 20:53:23 +00:00
Rafael Espindola 3e2b21cd4d Change llvm-ar to use lib/Object.
This fixes two bugs is lib/Object that the use in llvm-ar found:
* In OS X created archives, the name can be padded with nulls. Strip them.
* In the constructor, remember the first non special member and use that in
  begin_children. This makes sure we skip all special members, not just the
  first one.

The change to llvm-ar itself consist of
* Using lib/Object for reading archives instead of ArchiveReader.cpp.
* Writing the modified archive directly, instead of creating an in memory
  representation.

The old Archive library was way more general than what is needed, as can
be seen by the diffstat of this patch.

Having llvm-ar using lib/Object now opens the way for creating regular symbol
tables for both native objects and bitcode files so that we can use those
archives for LTO.

llvm-svn: 186197
2013-07-12 20:21:39 +00:00
Rafael Espindola 9cef215724 Add a test for llvm-ar's u option.
llvm-svn: 186192
2013-07-12 19:34:24 +00:00
Rafael Espindola c5acd1ca84 Relax the test a bit more to handle different UIDs and GIDs.
llvm-svn: 186186
2013-07-12 19:13:16 +00:00
Rafael Espindola 5f1ef3c8aa Relax test a bit to handle umask differences.
llvm-svn: 186184
2013-07-12 18:54:28 +00:00
Rafael Espindola 3e7249fb15 Add a test for the 'o' option in llvm-ar.
llvm-svn: 186183
2013-07-12 18:51:25 +00:00
Rafael Espindola f0c617264a Don't reject an empty archive.
llvm-svn: 186159
2013-07-12 13:32:28 +00:00
NAKAMURA Takumi aaaec3db98 llvm/test/Object/archive-toc.test: Use env(1) to satisfy win32 hosts.
llvm-svn: 186143
2013-07-12 02:34:45 +00:00
Rafael Espindola dee53e76f6 Add tests for the before and after modifiers.
llvm-svn: 186118
2013-07-11 21:11:55 +00:00
Rafael Espindola 621ca94358 Add a test for llvm-ar's m operation.
llvm-svn: 186110
2013-07-11 19:09:04 +00:00
Rafael Espindola b1c1c5f377 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.

llvm-svn: 186090
2013-07-11 15:35:23 +00:00
Rafael Espindola a7f6913c08 Merge these tests.
llvm-svn: 186084
2013-07-11 13:44:10 +00:00
Rafael Espindola 70a765dc47 Use a more unique name to avoid conflicting with directory.ll tests when running
in parallel.

llvm-svn: 186083
2013-07-11 13:31:38 +00:00
Rafael Espindola 0ec47c801d Add a test for llvm-ar's 'd' operation.
llvm-svn: 186082
2013-07-11 13:24:27 +00:00
Rafael Espindola 54dbca5eeb Add tests for the 'x' operation.
llvm-svn: 186081
2013-07-11 13:13:09 +00:00
Rafael Espindola 555aa899c6 Remove this test for now.
It is not reliable to depend on the output of llvm_unreachable. The original
change will have proper tests when llvm-ar moves to lib/Object (soon).

llvm-svn: 186043
2013-07-10 22:15:29 +00:00
Rafael Espindola 555099207b Find the symbol table on archives created on OS X.
llvm-svn: 186041
2013-07-10 22:07:59 +00:00
Rafael Espindola 3b5475c0f2 Move tests from test/Archive to test/Object.
There is no lib/Archive anymore and some archive tests were in test/Archive and
others in test/Object. Since archive is just one of the formats supported by
lib/Object, test/Object is probably the best location.

llvm-svn: 186038
2013-07-10 21:47:16 +00:00
Rafael Espindola fbcafc0793 Don't crash in 'llvm -s' when an archive has no symtab.
llvm-svn: 186029
2013-07-10 20:14:22 +00:00