Commit Graph

38 Commits

Author SHA1 Message Date
Reid Kleckner 4270493bca Use noexcept directly now that all compilers support it
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@284671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 23:50:50 +00:00
Benjamin Kramer b6fa2c9229 Unpollute the global namespace. lld edition.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@277926 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 13:52:37 +00:00
Pete Cooper 25f46b962f Remove unused variants of make_dynamic_error_code. NFC.
make_dynamic_error_code was used to create a std::error_code with
a std::string message.  Now that we are migrating to llvm::Error,
there are no calls to these make_dynamic_error_code methods.

There is one single call to make_dynamic_error_code remaining, the one
inside GenericError::convertToErrorCode().  That method is only called
from File::doParse() which should be a temporary situation.  We need
to work out how to deal with File::parse() caching the error result from
doParse().  Caching errors isn't supported in the new scheme, and probably
isn't needed here, but we need to work that out.

Once thats done, dynamic error and all utilities around it can be deleted.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31 01:21:50 +00:00
Pete Cooper 0919db13c7 Change getReferenceInfo/getPairReferenceInfo to use new Error handling. NFC.
Adds a GenericError class to lld/Core which can carry a string.  This is
analygous to the dynamic_error we currently use in lld/Core.

Use this GenericError instead of make_dynamic_error_code.  Also, provide
an implemention of GenericError::convertToErrorCode which for now converts
it in to the dynamic_error_code we used to have.  This will go away once
all the APIs are converted.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 20:15:06 +00:00
Rui Ueyama 2d83391bee Remove dead code. This error type is for the old linker script reader.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 02:51:02 +00:00
Rui Ueyama bd7e568452 Fix Clang-tidy misc-use-override warnings, other minor fixes.
Patch from Eugene Zelenko!

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@247323 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:51:36 +00:00
Denis Protivensky efe44ac679 [LinkerScript] Process program header in PHDRS command
Add PT_PHDR segment depending on its availability in linker script's
PHDRS command, fallback if no linker script is given.
Handle FILEHDR, PHDRS and FLAGS attributes of program header.

Differential Revision: http://reviews.llvm.org/D11589


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@244743 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 12:31:35 +00:00
Denis Protivensky f5dad35f9a [LinkerScript] Add matching of output sections to segments
Add method to query segments for specified output section name.
Return error if the section is assigned to unknown segment.
Check matching of sections to segments during layout on the subject of correctness.
NOTE: no actual functionality of using custom segments is implemented.

Differential Revision: http://reviews.llvm.org/D10359


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@239719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 08:00:51 +00:00
Rafael Espindola 11fbfda478 Remove unused enum value. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@235742 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 18:36:57 +00:00
Rui Ueyama 5eeaf55607 Define make_dynamic_error_code(const char *).
The function took either StringRef or Twine. Since string literals are
ambiguous when resolving the overloading, many code calls used this
function with explicit type conversion. That led awkward code like
make_dynamic_error_code(Twine("Error occurred")).

This patch adds a function definition for string literals, so that
you can directly call the function with literals.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234841 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 02:34:09 +00:00
Rui Ueyama ff05d4477f Remove the Native file format.
The Native file format was designed to be the fastest on-memory or
on-disk file format for object files. The problem is that no one
is working on that. No LLVM tools can produce object files in
the Native, thus the feature of supporting the format is useless
in the linker.

This patch removes the Native file support. We can add it back
if we really want it in future.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 21:23:51 +00:00
Rafael Auler 56c448aa83 [LinkerScript] Implement linker script expression evaluation
The expression evaluation is needed when interpreting linker scripts, in order
to calculate the value for new symbols or to determine a new position to load
sections in memory. This commit extends Expression nodes from the linker script
AST with evaluation functions, and also contains a unit test.

http://reviews.llvm.org/D8156


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@231707 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-09 21:43:35 +00:00
Shankar Easwaran f80e2e5f1e [Core,MachO,Test] Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@230192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-22 23:54:38 +00:00
Rui Ueyama 770c973fd6 Use std::recursive_mutex instead of llvm's SmartMutex.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@226236 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 00:55:01 +00:00
Rui Ueyama 78059b714d Replace ReaderError with DynamicError.
ReaderErrorCategory was used only at one place. We now have a
DynamicErrorCategory for this kind of one-time error, so use it.
The calling function doesn't really care the type of an error, so
ReaderErrorCategory was actually dead code.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@224245 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 12:20:13 +00:00
Rui Ueyama ae76d8af96 Simplify InputGraph API.
These member functions returns either no_more_files error or a File object.
We could simply return a nullptr instead of a no_more_files.
This function will be removed soon as a part of InputGraph cleanup.
I had to do that step by step.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@224208 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-14 02:04:01 +00:00
Shankar Easwaran 66605ff243 Sort include files according to convention.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@220131 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 05:33:55 +00:00
NAKAMURA Takumi c8189306c8 lld/lib/Core/Error.cpp: Appease g++-4.7, corresponding to LLVM r210687.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@220039 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 12:55:49 +00:00
Saleem Abdulrasool fff220da4a PE/COFF: add a check to ensure that we dont mix up architectures
Previously, we would not check the target machine type and the module (object)
machine type.  Add a check to ensure that we do not attempt to use an object
file with a different target architecture.

This change identified a couple of tests which were incorrectly mixing up
architecture types, using x86 input for a x64 target.  Adjust the tests
appropriately.  The renaming of the input and the architectures covers the
changes to the existing tests.

One significant change to the existing tests is that the newly added test input
for x64 uses the correct user label prefix for X64.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@219093 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-05 23:43:59 +00:00
Saleem Abdulrasool 2bbd29d5b5 Core: switch error mapping to switches
Rather than a series of cascading ifs, use a switch statement to convert the
error code to a string.  This has the benefit of allowing the compiler to inform
us if we ever add a new error code but fail to update the string representation.

Add in stringified versions for a couple of missing InputGraphErrors.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@219089 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-05 21:30:32 +00:00
Rafael Espindola 7f3f96d0d5 Remove unused and odd code.
This code was never being used and any use of it would look fairly strange.
For example, it would try to map a NativeReaderError::file_malformed to
std::errc::invalid_argument.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210913 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 15:36:45 +00:00
Rafael Espindola 349675667e replace llvm::error_code with std::error_code.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 14:04:54 +00:00
Rafael Espindola 07fc49e870 Use error_category from the std namespace.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210732 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 01:44:19 +00:00
Rafael Espindola c5f03b07e3 Use error_condition from the std namespace.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210730 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 01:28:12 +00:00
Rafael Espindola a981557c26 Use std::error_code instead of llvm::error_code.
This is an update for a llvm api change.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210689 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 19:05:58 +00:00