diff options
author | Sven Gothel <[email protected]> | 2019-12-12 07:29:07 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-12 07:29:07 +0100 |
commit | 07aeed47e484bfec85e749ea721756b8a2571e00 (patch) | |
tree | b77ce918b3ee90349ec4e72de5893664e1b27097 /src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java | |
parent | 79a8fed9fddab5429a3457c3077ee5012b405a51 (diff) |
Bug 1417 (JogAmp): New CCTask parameter 'writesoname': Adds GnuLinker and clang linker '-h name' options, writing SONAME for shares libraries
Setting the SONAME via general options simplifies the adoption of SONAME,
as the individual linker configurations must not change in the user projects.
This is new option for conveninience and scaling.
Feature is currently enabled for the GnuLinker (GccLinker 'gcc' + GppLinker 'gpp') as well as for clang (clang).
The SONAME must be set on Android API level >= 23,
see gluegen commit 51ef5eadd9db020412d3a3716b4ab5a25b0522fb.
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]; } |