summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-06-15 14:18:22 +0200
committerSven Gothel <[email protected]>2019-06-15 14:18:22 +0200
commit6523322893a0f18cef7b45e693249e147721990e (patch)
tree9b35d616d0952eb814b53e4406da908b38a65289 /src/main/java/net/sf/antcontrib/cpptasks/gcc/cross
parentbd21aded190bb92261e4a01acdfa8e1be2158474 (diff)
Adding option 'usehighleveltool'
Adding option 'usehighleveltool', which gives preference to the higher level tool selection. Default is false. Currently 'usehighleveltool' is implemented for LinkType operation to build a static library, i.e. 'outtype' target is 'static'. If set to false (default), the default low level 'ar' librarian tool is being used. If set to true, the high-level tool gcc, g++ or clang (w/ or w/o xcode's xcrun) will be used to process the command. This might have some advantages where xcode's clang may validate consistency of the result, i.e. missing symbols etc.
Diffstat (limited to 'src/main/java/net/sf/antcontrib/cpptasks/gcc/cross')
-rwxr-xr-xsrc/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java16
-rwxr-xr-xsrc/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java16
2 files changed, 28 insertions, 4 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java
index 3bdcf82..27774a1 100755
--- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java
@@ -34,6 +34,9 @@ public class GccLinker extends AbstractLdLinker {
private static final String[] discardFiles = new String[0];
private static final String[] objFiles = new String[]{".o", ".a", ".lib",
".dll", ".so", ".sl"};
+ private static final GccLinker arLinker = new GccLinker("gcc", objFiles,
+ discardFiles, "lib", ".a", false, new GccLinker("gcc", objFiles,
+ discardFiles, "lib", ".a", true, null));
private static final GccLinker dllLinker = new GccLinker("gcc", objFiles,
discardFiles, "lib", ".so", false, new GccLinker("gcc", objFiles,
discardFiles, "lib", ".so", true, null));
@@ -45,6 +48,8 @@ public class GccLinker extends AbstractLdLinker {
"-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s",
"-static", "-shared", "-symbolic", "-Xlinker",
"--export-all-symbols", "-static-libgcc", "-static-libstdc++",};
+ private static final GccLinker machArLinker = new GccLinker("gcc",
+ objFiles, discardFiles, "lib", ".a", false, null);
private static final GccLinker machBundleLinker = new GccLinker("gcc",
objFiles, discardFiles, "lib", ".bundle", false, null);
private static final GccLinker machDllLinker = new GccLinker("gcc",
@@ -195,10 +200,17 @@ public class GccLinker extends AbstractLdLinker {
}
return libDirs;
}
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
+ public Linker getLinker(final LinkType type) {
+ if ( type.isStaticLibrary() && !type.getUseHighlevelTool() ) {
return GccLibrarian.getInstance();
}
+ if (type.isStaticLibrary()) {
+ if (isDarwin()) {
+ return machArLinker;
+ } else {
+ return arLinker;
+ }
+ }
if (type.isPluginModule()) {
if (isDarwin()) {
return machBundleLinker;
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java
index 319668b..afcedd5 100755
--- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java
+++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java
@@ -38,6 +38,9 @@ public class GppLinker extends AbstractLdLinker {
protected static final String[] discardFiles = new String[0];
protected static final String[] objFiles = new String[]{".o", ".a", ".lib",
".dll", ".so", ".sl"};
+ private static final GppLinker arLinker = new GppLinker("gcc", objFiles,
+ discardFiles, "lib", ".a", false, new GppLinker("gcc", objFiles,
+ discardFiles, "lib", ".a", true, null));
private static final GppLinker dllLinker = new GppLinker("gcc", objFiles,
discardFiles, "lib", ".so", false, new GppLinker("gcc", objFiles,
discardFiles, "lib", ".so", true, null));
@@ -49,6 +52,8 @@ public class GppLinker extends AbstractLdLinker {
"-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"};
private static final GppLinker instance = new GppLinker("gcc", objFiles,
discardFiles, "", "", false, null);
+ private static final GppLinker machArLinker = new GppLinker("gcc",
+ objFiles, discardFiles, "lib", ".a", false, null);
private static final GppLinker machDllLinker = new GppLinker("gcc",
objFiles, discardFiles, "lib", ".dylib", false, null);
private static final GppLinker machPluginLinker = new GppLinker("gcc",
@@ -189,10 +194,17 @@ public class GppLinker extends AbstractLdLinker {
}
return libDirs;
}
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
+ public Linker getLinker(final LinkType type) {
+ if ( type.isStaticLibrary() && !type.getUseHighlevelTool() ) {
return GccLibrarian.getInstance();
}
+ if (type.isStaticLibrary()) {
+ if (isDarwin()) {
+ return machArLinker;
+ } else {
+ return arLinker;
+ }
+ }
if (type.isPluginModule()) {
if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
return machPluginLinker;