当前位置: 首页>>代码示例>>C++>>正文


C++ Linker::reset方法代码示例

本文整理汇总了C++中Linker::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Linker::reset方法的具体用法?C++ Linker::reset怎么用?C++ Linker::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Linker的用法示例。


在下文中一共展示了Linker::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: search_dir

// This testcase put IRBuilder in the heap
TEST_F( LinkerTest, plasma_twice_irbuilder_heap) {

    Initialize();
    Linker linker;

    ///< --mtriple="armv7-none-linux-gnueabi"
    LinkerConfig config1("armv7-none-linux-gnueabi");

    LinkerScript script1;
    /// -L=${TOPDIR}/test/libs/ARM/Android/android-14
    Path search_dir(TOPDIR);
    search_dir.append("test/libs/ARM/Android/android-14");
    script1.directories().insert(search_dir);

    /// To configure linker before setting options. Linker::config sets up
    /// default target-dependent configuration to LinkerConfig.
    linker.emulate(script1, config1);

    config1.setCodeGenType(LinkerConfig::DynObj);  ///< --shared
    config1.options().setSOName("libplasma.once.so");   ///< --soname=libplasma.twice.so
    config1.options().setBsymbolic(false);              ///< -Bsymbolic

    Module module1("libplasma.once.so", script1);
    IRBuilder *builder1 = new IRBuilder(module1, config1);

    /// ${TOPDIR}/test/libs/ARM/Android/android-14/crtbegin_so.o
    Path crtbegin(search_dir);
    crtbegin.append("crtbegin_so.o");
    builder1->ReadInput("crtbegin", crtbegin);

    /// ${TOPDIR}/test/Android/Plasma/ARM/plasma.o
    Path plasma(TOPDIR);
    plasma.append("test/Android/Plasma/ARM/plasma.o");
    builder1->ReadInput("plasma", plasma);

    // -lm -llog -ljnigraphics -lc
    builder1->ReadInput("m");
    builder1->ReadInput("log");
    builder1->ReadInput("jnigraphics");
    builder1->ReadInput("c");

    /// ${TOPDIR}/test/libs/ARM/Android/android-14/crtend_so.o
    Path crtend(search_dir);
    crtend.append("crtend_so.o");
    builder1->ReadInput("crtend", crtend);

    if (linker.link(module1, *builder1)) {
        linker.emit("libplasma.once.so"); ///< -o libplasma.so
    }

    // Can not delete builder until emit the output. Dynamic string table
    // needs the file name of the input files, and the inputs' life is
    // controlled by IRBuilder
    delete builder1;

    Finalize();

    linker.reset();

    Initialize();

    ///< --mtriple="armv7-none-linux-gnueabi"
    LinkerConfig config2("armv7-none-linux-gnueabi");

    LinkerScript script2;
    /// -L=${TOPDIR}/test/libs/ARM/Android/android-14
    script2.directories().insert(search_dir);

    /// To configure linker before setting options. Linker::config sets up
    /// default target-dependent configuration to LinkerConfig.
    linker.emulate(script2, config2);

    config2.setCodeGenType(LinkerConfig::DynObj);  ///< --shared
    config2.options().setSOName("libplasma.twice.so");   ///< --soname=libplasma.twice.exe
    config2.options().setBsymbolic();              ///< -Bsymbolic

    Module module2("libplasma.so", script2);
    IRBuilder* builder2 = new IRBuilder(module2, config2);

    /// ${TOPDIR}/test/libs/ARM/Android/android-14/crtbegin_so.o
    builder2->ReadInput("crtbegin", crtbegin);

    /// ${TOPDIR}/test/Android/Plasma/ARM/plasma.o
    builder2->ReadInput("plasma", plasma);

    // -lm -llog -ljnigraphics -lc
    builder2->ReadInput("m");
    builder2->ReadInput("log");
    builder2->ReadInput("jnigraphics");
    builder2->ReadInput("c");

    /// ${TOPDIR}/test/libs/ARM/Android/android-14/crtend_so.o
    builder2->ReadInput("crtend", crtend);

    if (linker.link(module2, *builder2)) {
        linker.emit("libplasma.twice.so"); ///< -o libplasma.exe
    }

    delete builder2;
//.........这里部分代码省略.........
开发者ID:rig-project,项目名称:mclinker,代码行数:101,代码来源:LinkerTest.cpp


注:本文中的Linker::reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。