# - the shared library symbols have been swept in section garbage collection.
# Verify that the symbols are global rather than local and that a version
# script adjusts them accordingly.
+# Also verify that a version definition supplied by an object rather than
+# a version script and forcibly exported is unaffected by section GC.
if { [check_gc_sections_available] } {
run_ld_link_tests [list \
[list \
{pr20828.s} \
{{readelf --dyn-syms pr20828-b.sd} \
{readelf --dyn-syms pr20828-c.sd}} \
- "pr20828-2.so"]]
+ "pr20828-2.so"] \
+ [list \
+ "PR ld/20828 dynamic symbols with section GC\
+ (versioned shared library)" \
+ "$LFLAGS -shared --gc-sections -T pr20828.ld\
+ --version-script=pr20828-v.ver" \
+ "" "$AFLAGS_PIC" \
+ {pr20828.s} \
+ {{readelf --dyn-syms pr20828-c.sd} \
+ {readelf --dyn-syms pr20828-d.sd} \
+ {readelf --dyn-syms pr20828-e.sd}} \
+ "libpr20828-v.so"] \
+ [list \
+ "PR ld/20828 dynamic symbols with section GC (versioned)" \
+ "$LFLAGS -shared --gc-sections -T pr20828.ld\
+ --version-script=pr20828-v.ver" \
+ "tmpdir/libpr20828-v.so" \
+ "$AFLAGS_PIC" \
+ {pr20828.s} \
+ {{readelf --dyn-syms pr20828-c.sd} \
+ {readelf --dyn-syms pr20828-d.sd} \
+ {readelf --dyn-syms pr20828-e.sd}} \
+ "pr20828-v.so"] \
+ [list \
+ "PR ld/20828 forcibly exported symbol version without section GC" \
+ "$LFLAGS -e foo -E -T pr20828-v.ld" "" "" \
+ {pr20828-v.s} \
+ {{objdump -p pr20828-v.od}} \
+ "pr20828-v-1"] \
+ [list \
+ "PR ld/20828 forcibly exported symbol version with section GC" \
+ "$LFLAGS -e foo --gc-sections -E -T pr20828-v.ld" "" "" \
+ {pr20828-v.s} \
+ {{objdump -p pr20828-v.od}} \
+ "pr20828-v-2"]]
}
# Check to see if the C compiler works
"-shared" "-fPIC"
{beginwarn.c end.c}
{{readelf {-S --wide} libbarw.rd}
- {warning "^.*\\): warning: function foo is deprecated$"}}
+ {warning "^.*beginwarn.c:7: warning: function foo is deprecated$"}}
"libbarw.so" "c"}
{"Build hidden libbar.so"
"-shared" "-fPIC"
"" ""
{pr2404b.c} {} "libpr2404b.a"}
{"Build rdynamic-1"
- "-rdynamic -Wl,--gc-sections" "-ffunction-sections"
+ "-Wl,-export-dynamic,--gc-sections" "-ffunction-sections"
{rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
{"Build dynamic-1"
"-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
[list "Run warn with versioned libfoo.so" \
"-Wl,--no-as-needed tmpdir/beginwarn.o tmpdir/libfoov.so" "" \
{main.c} "warn" "warn.out" \
- "" "c" {^.*\): warning: function foo is deprecated$} ] \
+ "" "c" {^.*beginwarn.c:7: warning: function foo is deprecated$} ] \
[list "Run protected with versioned libfoo.so" \
"-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" \
{main.c} "protected" "normal.out" ] \
"-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
{dl3.cc} {} "libdl3c.so" "c++"}
{"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
- "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
+ "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC -ansi"
{del.cc new.cc} {} "libnew1a.so" "c++"}
{"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
- "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC"
+ "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC -ansi"
{del.cc new.cc} {} "libnew1b.so" "c++"}
}
{dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
{"Run with libnew1a.so"
"-Wl,--no-as-needed tmpdir/libnew1a.so" ""
- {dl5.cc} "dl5a" "dl5.out" "" "c++"}
+ {dl5.cc} "dl5a" "dl5.out" "-ansi" "c++"}
{"Run with libnew1b.so"
"-Wl,--no-as-needed tmpdir/libnew1b.so" ""
- {dl5.cc} "dl5b" "dl5.out" "" "c++"}
+ {dl5.cc} "dl5b" "dl5.out" "-ansi" "c++"}
}
run_cc_link_tests $build_cxx_tests