diff options
Diffstat (limited to 'src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java')
-rw-r--r-- | src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java index d7b30cd..8ed0b2f 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java @@ -31,6 +31,7 @@ import net.sf.antcontrib.cpptasks.types.CommandLineArgument; import net.sf.antcontrib.cpptasks.types.LibrarySet; import net.sf.antcontrib.cpptasks.TargetDef; import net.sf.antcontrib.cpptasks.VersionInfo; +import net.sf.antcontrib.cpptasks.gcc.GccProcessor; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.Environment; @@ -328,13 +329,17 @@ public abstract class CommandLineLinker extends AbstractLinker final String outputDir, final String outputFile, final String[] sourceFiles, - final CommandLineLinkerConfiguration config) { + final CommandLineLinkerConfiguration config) + { final String[] preargs = config.getPreArguments(); final String[] endargs = config.getEndArguments(); final String outputSwitch[] = getOutputFileSwitch(task, outputFile); + final boolean writeSONAME = task.getWriteSONAME() && task.isSharedLibrary() && ( isGCC || isCLANG ); int allArgsCount = preargs.length + 1 + outputSwitch.length + - sourceFiles.length + endargs.length; + sourceFiles.length + endargs.length + + ( writeSONAME ? 1 : 0 ); + if (isLibtool) { allArgsCount++; } @@ -354,6 +359,9 @@ public abstract class CommandLineLinker extends AbstractLinker for (int i = 0; i < preargs.length; i++) { allArgs[index++] = decorateLinkerOption(buf, preargs[i]); } + if( writeSONAME ) { + allArgs[index++] = "-Wl,-h,"+GccProcessor.getEscapedOutputFile(outputFile); + } for (int i = 0; i < outputSwitch.length; i++) { allArgs[index++] = outputSwitch[i]; } |