summaryrefslogtreecommitdiff
path: root/lib/Target/ELFEmulation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/ELFEmulation.cpp')
-rw-r--r--lib/Target/ELFEmulation.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Target/ELFEmulation.cpp b/lib/Target/ELFEmulation.cpp
index 3bd2094..bdd76aa 100644
--- a/lib/Target/ELFEmulation.cpp
+++ b/lib/Target/ELFEmulation.cpp
@@ -9,6 +9,8 @@
#include <mcld/Target/ELFEmulation.h>
#include <mcld/LinkerConfig.h>
+#include <llvm/Support/Host.h>
+
using namespace mcld;
struct NameMap {
@@ -61,6 +63,7 @@ static const NameMap map[] =
bool mcld::MCLDEmulateELF(LinkerConfig& pConfig)
{
+ // set up section map
if (pConfig.codeGenType() != LinkerConfig::Object) {
const unsigned int map_size = (sizeof(map) / sizeof(map[0]) );
for (unsigned int i = 0; i < map_size; ++i) {
@@ -70,6 +73,18 @@ bool mcld::MCLDEmulateELF(LinkerConfig& pConfig)
return false;
}
}
+
+ if (!pConfig.options().nostdlib()) {
+ // TODO: check if user sets the default search path instead via -Y option
+ // set up default search path
+ if (llvm::Triple::NetBSD == pConfig.targets().triple().getOS()) {
+ pConfig.options().directories().insert("=/usr/lib");
+ }
+ else {
+ pConfig.options().directories().insert("=/lib");
+ pConfig.options().directories().insert("=/usr/lib");
+ }
+ }
return true;
}