cflags => '-Wtarget=tns/r -Wsystype=guardian',
lflags => '-Wld="-set systype guardian"',
shared_ldflag => '-Wshared -Wld="-export_all -soname $(@:lib%.so=%)"',
+ shared_argfileflag => '-Wld_obey=',
},
# Itanium + guardian:
cflags => '-Wtarget=tns/e -Wsystype=guardian',
lflags => '-Weld="-set systype guardian"',
shared_ldflag => '-Wshared -Weld="-export_all -soname $(@:lib%.so=%)"',
+ shared_argfileflag => '-Weld_obey=',
},
# x86 + guardian:
cflags => '-Wtarget=tns/x -Wsystype=guardian',
lflags => '-Wxld="-set systype guardian"',
shared_ldflag => '-Wshared -Wxld="-export_all -soname $(@:lib%.so=%)"',
+ shared_argfileflag => '-Wxld_obey=',
},
# MIPS + oss (unused but present for convenience):
cflags => '-Wtarget=tns/r -Wsystype=oss',
lflags => '-Wld="-set systype oss"',
shared_ldflag => '-Wshared -Wld="-export_all"',
+ shared_argfileflag => '-Wld_obey=',
},
# Itanium + oss:
'nonstop-archenv-itanium-oss' => {
cflags => '-Wtarget=tns/e -Wsystype=oss',
lflags => '-Weld="-set systype oss"',
shared_ldflag => '-Wshared -Weld="-export_all"',
+ shared_argfileflag => '-Weld_obey=',
},
# x86_64 + oss:
'nonstop-archenv-x86_64-oss' => {
cflags => '-Wtarget=tns/x -Wsystype=oss',
lflags => '-Wxld="-set systype oss"',
shared_ldflag => '-Wshared -Wxld="-export_all"',
+ shared_argfileflag => '-Wxld_obey=',
},
# Size variants
my $simple = platform->sharedlib_simple($args{lib});
my $full = platform->sharedlib($args{lib});
+ my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
my $shared_soname = "";
$shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
if defined $target{shared_sonameflag};
if defined $target{shared_impflag};
my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
- my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
- my $deps = join(" \\\n" . ' ' x (length($full) + 2),
- fill_lines(' ', $COLUMNS - length($full) - 2,
- @objs, @defs, @deps));
+ # There is at least one platform where the compiler-as-linker needs to
+ # have one object file directly on the command line. That won't hurt
+ # any other platform, so we do that for everyone when there's an argfile
+ # to be had. This depends heavily on splice, which removes elements from
+ # the given array, and returns them so they can be captured.
+ my @argfileobjs = $argfile
+ ? splice(@objs, 1)
+ : ();
+ my $argfilecmds = $argfile
+ ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
+ : undef;
+ my $argfiledeps = $argfile
+ ? join(" \\\n" . ' ' x (length($argfile) + 2),
+ fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
+ : undef;
+ my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
+ my @fullobjs = (
+ @objs,
+ ($argfile ? $target{shared_argfileflag}.$argfile : ())
+ );
+ my $fulldeps =
+ join(" \\\n" . ' ' x (length($full) + 2),
+ fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
+ my $fullobjs =
+ join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
my $recipe = <<"EOF";
$simple: $full
EOF
}
$recipe .= <<"EOF";
-$full: $deps
+$full: $fulldeps
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-o $full$shared_def \\
- $objs \\
+ $fullobjs \\
$linklibs \$(LIB_EX_LIBS)
EOF
if (windowsdll()) {
cp -p $full fuzz/
EOF
}
+ $recipe .= <<"EOF" if defined $argfile;
+$argfile: $argfiledeps
+ \$(RM) $argfile
+ $argfilecmds
+EOF
return $recipe;
}
sub obj2dso {