本文整理汇总了C++中Linker::emulate方法的典型用法代码示例。如果您正苦于以下问题:C++ Linker::emulate方法的具体用法?C++ Linker::emulate怎么用?C++ Linker::emulate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::emulate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: config
// %MCLinker --shared -soname=libplasma.so -Bsymbolic
// -mtriple="armv7-none-linux-gnueabi"
// -L=%p/../../../libs/ARM/Android/android-14
// %p/../../../libs/ARM/Android/android-14/crtbegin_so.o
// %p/plasma.o
// -lm -llog -ljnigraphics -lc
// %p/../../../libs/ARM/Android/android-14/crtend_so.o
// -o libplasma.so
TEST_F( LinkerTest, plasma) {
Initialize();
Linker linker;
LinkerScript script;
///< --mtriple="armv7-none-linux-gnueabi"
LinkerConfig config("armv7-none-linux-gnueabi");
/// -L=${TOPDIR}/test/libs/ARM/Android/android-14
Path search_dir(TOPDIR);
search_dir.append("test/libs/ARM/Android/android-14");
script.directories().insert(search_dir);
/// To configure linker before setting options. Linker::config sets up
/// default target-dependent configuration to LinkerConfig.
linker.emulate(script, config);
config.setCodeGenType(LinkerConfig::DynObj); ///< --shared
config.options().setSOName("libplasma.so"); ///< --soname=libplasma.so
config.options().setBsymbolic(); ///< -Bsymbolic
Module module("libplasma.so", script);
IRBuilder builder(module, config);
/// ${TOPDIR}/test/libs/ARM/Android/android-14/crtbegin_so.o
Path crtbegin(search_dir);
crtbegin.append("crtbegin_so.o");
builder.ReadInput("crtbegin", crtbegin);
/// ${TOPDIR}/test/Android/Plasma/ARM/plasma.o
Path plasma(TOPDIR);
plasma.append("test/Android/Plasma/ARM/plasma.o");
builder.ReadInput("plasma", plasma);
// -lm -llog -ljnigraphics -lc
builder.ReadInput("m");
builder.ReadInput("log");
builder.ReadInput("jnigraphics");
builder.ReadInput("c");
/// ${TOPDIR}/test/libs/ARM/Android/android-14/crtend_so.o
Path crtend(search_dir);
crtend.append("crtend_so.o");
builder.ReadInput("crtend", crtend);
if (linker.link(module, builder)) {
linker.emit("libplasma.so"); ///< -o libplasma.so
}
Finalize();
}
示例2: 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;
//.........这里部分代码省略.........