Home | History | Annotate | Download | only in Support
      1 /*
      2  * Copyright 2012, The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef BCC_SUPPORT_LINKER_CONFIG_H
     18 #define BCC_SUPPORT_LINKER_CONFIG_H
     19 
     20 #include <string>
     21 
     22 #include <mcld/MC/MCLDInfo.h>
     23 #include <mcld/Support/TargetRegistry.h>
     24 #include <mcld/LD/DiagnosticLineInfo.h>
     25 #include <mcld/LD/DiagnosticPrinter.h>
     26 
     27 namespace bcc {
     28 
     29 class LinkerConfig {
     30 private:
     31   //===--------------------------------------------------------------------===//
     32   // Available Configurations
     33   //===--------------------------------------------------------------------===//
     34   const std::string mTriple;
     35   bool mShared;
     36   std::string mSOName;
     37 
     38 private:
     39   //===--------------------------------------------------------------------===//
     40   // These are generated by LinkerConfig during initialize().
     41   //===--------------------------------------------------------------------===//
     42   const mcld::Target *mTarget;
     43   bool initializeTarget();
     44 
     45   mcld::MCLDInfo *mLDInfo;
     46   bool initializeLDInfo();
     47 
     48   mcld::DiagnosticLineInfo *mDiagLineInfo;
     49   mcld::DiagnosticPrinter *mDiagPrinter;
     50   bool initializeDiagnostic();
     51 
     52 public:
     53   //===--------------------------------------------------------------------===//
     54   // Getters
     55   //===--------------------------------------------------------------------===//
     56   inline const std::string &getTriple() const
     57   { return mTriple; }
     58 
     59   inline const mcld::Target *getTarget() const
     60   { return mTarget; }
     61 
     62   inline mcld::MCLDInfo* getLDInfo()
     63   { return mLDInfo; }
     64 
     65   inline const mcld::MCLDInfo* getLDInfo() const
     66   { return mLDInfo; }
     67 
     68   inline bool isShared() const
     69   { return mShared; }
     70 
     71   inline std::string getSOName() const
     72   { return mSOName; }
     73 
     74   void setShared(bool pEnable = true);
     75 
     76   void setBsymbolic(bool pEnable = true);
     77 
     78   void setSOName(const std::string &pSOName);
     79 
     80   void setDyld(const std::string &pDyld);
     81 
     82   void setSysRoot(const std::string &pSysRoot);
     83 
     84   void addWrap(const std::string &pWrapSymbol);
     85 
     86   void addPortable(const std::string &pPortableSymbol);
     87 
     88   void addSearchDir(const std::string &pDir);
     89 
     90 public:
     91   LinkerConfig(const std::string& pTriple);
     92 
     93   virtual ~LinkerConfig();
     94 };
     95 
     96 } // end namespace bcc
     97 
     98 #endif // BCC_SUPPORT_LINKER_CONFIG_H
     99