• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- AndroidSectLinker.cpp ----------------------------------------------===//
2 //
3 //                     The MCLinker Project
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include <mcld/Target/AndroidSectLinker.h>
11 
12 #include <llvm/Support/ErrorHandling.h>
13 #include <mcld/MC/MCLDDirectory.h>
14 #include <mcld/CodeGen/SectLinkerOption.h>
15 
16 using namespace mcld;
17 
18 //==========================
19 // AndroidSectLinker
20 
AndroidSectLinker(SectLinkerOption & pOption,TargetLDBackend & pLDBackend)21 AndroidSectLinker::AndroidSectLinker(SectLinkerOption &pOption,
22                                      TargetLDBackend &pLDBackend)
23   : SectLinker(pOption, pLDBackend) {
24 }
25 
~AndroidSectLinker()26 AndroidSectLinker::~AndroidSectLinker()
27 {
28   // SectLinker will delete m_pLDBackend and m_pLDDriver;
29 }
30 
addTargetOptions(llvm::Module & pM,SectLinkerOption & pOption)31 void AndroidSectLinker::addTargetOptions(llvm::Module &pM,
32                                          SectLinkerOption &pOption)
33 {
34   // -----  Set up General Options  ----- //
35   MCLDInfo &info = pOption.info();
36   MCLDDirectory search_path("=/system/lib");
37   search_path.setSysroot(info.options().sysroot());
38   if (exists(search_path.path()) && is_directory(search_path.path()))
39     info.options().directories().add(search_path);
40   else {
41     // FIXME: need a warning function
42     llvm::errs() << "WARNING: can not open search directory: `-L" << search_path.name() << "'.\n";
43   }
44 }
45 
46