global tmpdir
if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
+ if { [llength $args] >= 2 } { set ldflags [lindex $args 1] } else { set ldflags "" }
# Build the shared library.
set shared -shared
set rpath /lib:$tmpdir
set exportflag " -Wl,-bexpall"
}
- if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
+ if ![ld_link $CC_FOR_TARGET $tmpdir/$progname "-Wl,-rpath,$rpath $ldflags $tmpdir/$main $tmpdir/$progname.so $exportflag"] {
if { [ string match $visibility "hidden" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
global shared_needs_pic
global PLT_CFLAGS
global NOPIE_CFLAGS
+ global NOPIE_LDFLAGS
global COMPRESS_LDFLAG
global NOSANITIZE_CFLAGS
global NOLTO_CFLAGS
} else {
# Compile the main program. Make sure that PLT is used since PLT
# is expected.
- if ![ld_compile "$CC_FOR_TARGET -g $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
+ if ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "visibility ($visibility) (non PIC)"
unsupported "visibility ($visibility)"
} else {
setup_xfail "*-*-beos*"
}
- visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o $datfile
+ visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o $datfile "" $NOPIE_LDFLAGS
# Test ELF shared library relocations with a non-zero load
# address for the library. Near as I can tell, the R_*_RELATIVE
if { ![is_xcoff_format] } {
visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o $datfile \
- "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
+ "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" $NOPIE_LDFLAGS
}
}
setup_xfail $target_triplet
}
}
- visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o $datfile $COMPRESS_LDFLAG
+ visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o $datfile $COMPRESS_LDFLAG $NOPIE_LDFLAGS
}
}}
setup_xfail "*-*-beos*"
}
- visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o $datfile
+ visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o $datfile "" $NOPIE_LDFLAGS
} else {
unsupported "visibility (PIC main, non PIC so)"
}
setup_xfail "*-*-beos*"
}
- visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o $datfile
+ visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o $datfile "" $NOPIE_LDFLAGS
} else {
unsupported "visibility ($visibility) (PIC main)"
}