The ld-gc testsuite tests ERROR: /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c: compilation failed UNRESOLVED: Check --gc-section FAIL: Check --gc-section/-q FAIL: Check --gc-section/-r/-e FAIL: Check --gc-section/-r/-u fail on cygwin... this is the collected output of ld-gc tests' log file: Running /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.exp ... Executing on host: /usr/local/src/trunk/objdir-binutils/ld/ld-new --help (timeout = 300) spawn /usr/local/src/trunk/objdir-binutils/ld/ld-new --help Usage: /usr/local/src/trunk/objdir-binutils/ld/.libs/ld-new [options] file... Options: -a KEYWORD Shared library control for HP/UX compatibility -A ARCH, --architecture ARCH Set architecture -b TARGET, --format TARGET Specify target for following input files -c FILE, --mri-script FILE Read MRI format linker script -d, -dc, -dp Force common symbols to be defined -e ADDRESS, --entry ADDRESS Set start address -E, --export-dynamic Export all dynamic symbols -EB Link big-endian objects -EL Link little-endian objects -f SHLIB, --auxiliary SHLIB Auxiliary filter for shared object symbol table -F SHLIB, --filter SHLIB Filter for shared object symbol table -g Ignored -G SIZE, --gpsize SIZE Small data size (if no size, same as --shared) -h FILENAME, -soname FILENAME Set internal name of shared library -I PROGRAM, --dynamic-linker PROGRAM Set PROGRAM as the dynamic linker to use -l LIBNAME, --library LIBNAME Search for library LIBNAME -L DIRECTORY, --library-path DIRECTORY Add DIRECTORY to library search path --sysroot=<DIRECTORY> Override the default sysroot location -m EMULATION Set emulation -M, --print-map Print map file on standard output -n, --nmagic Do not page align data -N, --omagic Do not page align data, do not make text readonly --no-omagic Page align data, make text readonly -o FILE, --output FILE Set output file name -O Optimize output file -Qy Ignored for SVR4 compatibility -q, --emit-relocs Generate relocations in final output -r, -i, --relocatable Generate relocatable output -R FILE, --just-symbols FILE Just link symbols (if directory, same as --rpath) -s, --strip-all Strip all symbols -S, --strip-debug Strip debugging symbols --strip-discarded Strip symbols in discarded sections --no-strip-discarded Do not strip symbols in discarded sections -t, --trace Trace file opens -T FILE, --script FILE Read linker script --default-script FILE, -dT Read default linker script -u SYMBOL, --undefined SYMBOL Start with undefined reference to SYMBOL --unique [=SECTION] Don't merge input [SECTION | orphan] sections -Ur Build global constructor/destructor tables -v, --version Print version information -V Print version and emulation information -x, --discard-all Discard all local symbols -X, --discard-locals Discard temporary local symbols (default) --discard-none Don't discard any local symbols -y SYMBOL, --trace-symbol SYMBOL Trace mentions of SYMBOL -Y PATH Default search path for Solaris compatibility -(, --start-group Start a group -), --end-group End a group --accept-unknown-input-arch Accept input files whose architecture cannot be determined --no-accept-unknown-input-arch Reject input files whose architecture is unknown --add-needed Set DT_NEEDED tags for DT_NEEDED entries in following dynamic libs --no-add-needed Do not set DT_NEEDED tags for DT_NEEDED entries in following dynamic libs --as-needed Only set DT_NEEDED for following dynamic libs if used --no-as-needed Always set DT_NEEDED for following dynamic libs -assert KEYWORD Ignored for SunOS compatibility -Bdynamic, -dy, -call_shared Link against shared libraries -Bstatic, -dn, -non_shared, -static Do not link against shared libraries -Bsymbolic Bind global references locally -Bsymbolic-functions Bind global function references locally --check-sections Check section addresses for overlaps (default) --no-check-sections Do not check section addresses for overlaps --cref Output cross reference table --defsym SYMBOL=EXPRESSION Define a symbol --demangle [=STYLE] Demangle symbol names [using STYLE] --embedded-relocs Generate embedded relocs --fatal-warnings Treat warnings as errors --no-fatal-warnings Do not treat warnings as errors (default) -fini SYMBOL Call SYMBOL at unload-time --force-exe-suffix Force generation of file with .exe suffix --gc-sections Remove unused sections (on some targets) --no-gc-sections Don't remove unused sections (default) --print-gc-sections List removed unused sections on stderr --no-print-gc-sections Do not list removed unused sections --hash-size=<NUMBER> Set default hash table size close to <NUMBER> --help Print option help -init SYMBOL Call SYMBOL at load-time -Map FILE Write a map file --no-define-common Do not define Common storage --no-demangle Do not demangle symbol names --no-keep-memory Use less memory and more disk I/O --no-undefined Do not allow unresolved references in object files --allow-shlib-undefined Allow unresolved references in shared libaries --no-allow-shlib-undefined Do not allow unresolved references in shared libs --allow-multiple-definition Allow multiple definitions --no-undefined-version Disallow undefined version --default-symver Create default symbol version --default-imported-symver Create default symbol version for imported symbols --no-warn-mismatch Don't warn about mismatched input files --no-warn-search-mismatch Don't warn on finding an incompatible library --no-whole-archive Turn off --whole-archive --noinhibit-exec Create an output file even if errors occur -nostdlib Only use library directories specified on the command line --oformat TARGET Specify target of output file -qmagic Ignored for Linux compatibility --reduce-memory-overheads Reduce memory overheads, possibly taking much longer --relax Relax branches on certain targets --retain-symbols-file FILE Keep only symbols listed in FILE -rpath PATH Set runtime shared library search path -rpath-link PATH Set link time shared library search path -shared, -Bshareable Create a shared library -pie, --pic-executable Create a position independent executable --sort-common [=ascending|descending] Sort common symbols by alignment [in specified order] --sort-section name|alignment Sort sections by name or maximum alignment --spare-dynamic-tags COUNT How many tags to reserve in .dynamic section --split-by-file [=SIZE] Split output sections every SIZE octets --split-by-reloc [=COUNT] Split output sections every COUNT relocs --stats Print memory usage statistics --target-help Display target specific options --task-link SYMBOL Do task level linking --traditional-format Use same format as native linker --section-start SECTION=ADDRESS Set address of named section -Tbss ADDRESS Set address of .bss section -Tdata ADDRESS Set address of .data section -Ttext ADDRESS Set address of .text section -Ttext-segment ADDRESS Set address of text segment --unresolved-symbols=<method> How to handle unresolved symbols. <method> is: ignore-all, report-all, ignore-in-object-files, ignore-in-shared-libs --verbose Output lots of information during link --version-script FILE Read version information script --version-exports-section SYMBOL Take export symbols list from .exports, using SYMBOL as the version. --dynamic-list-data Add data symbols to dynamic list --dynamic-list-cpp-new Use C++ operator new/delete dynamic list --dynamic-list-cpp-typeinfo Use C++ typeinfo dynamic list --dynamic-list FILE Read dynamic list --warn-common Warn about duplicate common symbols --warn-constructors Warn if global constructors/destructors are seen --warn-multiple-gp Warn if the multiple GP values are used --warn-once Warn only once per undefined symbol --warn-section-align Warn if start of section changes due to alignment --warn-shared-textrel Warn if shared object has DT_TEXTREL --warn-unresolved-symbols Report unresolved symbols as warnings --error-unresolved-symbols Report unresolved symbols as errors --whole-archive Include all objects from following archives --wrap SYMBOL Use wrapper functions for SYMBOL @FILE Read options from FILE /usr/local/src/trunk/objdir-binutils/ld/.libs/ld-new: supported targets: pe- i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex /usr/local/src/trunk/objdir-binutils/ld/.libs/ld-new: supported emulations: i386pe /usr/local/src/trunk/objdir-binutils/ld/.libs/ld-new: emulation specific options: i386pe: --base_file <basefile> Generate a base file for relocatable DLLs --dll Set image base to the default for DLLs --file-alignment <size> Set file alignment --heap <size> Set initial size of the heap --image-base <address> Set start address of the executable --major-image-version <number> Set version number of the executable --major-os-version <number> Set minimum required OS version --major-subsystem-version <number> Set minimum required OS subsystem version --minor-image-version <number> Set revision number of the executable --minor-os-version <number> Set minimum required OS revision --minor-subsystem-version <number> Set minimum required OS subsystem revision --section-alignment <size> Set section alignment --stack <size> Set size of the initial stack --subsystem <name>[:<version>] Set required OS subsystem [& version] --support-old-code Support interworking with old code --thumb-entry=<symbol> Set the entry point to be Thumb <symbol> --add-stdcall-alias Export symbols with and without @nn --disable-stdcall-fixup Don't link _sym to _sym@nn --enable-stdcall-fixup Link _sym to _sym@nn without warnings --exclude-symbols sym,sym,... Exclude symbols from automatic export --exclude-libs lib,lib,... Exclude libraries from automatic export --exclude-modules-for-implib mod,mod,... Exclude objects, archive members from auto export, place into import library instead. --export-all-symbols Automatically export all globals to DLL --kill-at Remove @nn from exported symbols --out-implib <file> Generate import library --output-def <file> Generate a .DEF file for the built DLL --warn-duplicate-exports Warn about duplicate exports. --compat-implib Create backward compatible import libs; create __imp_<SYMBOL> as well. --enable-auto-image-base Automatically choose image base for DLLs unless user specifies one --disable-auto-image-base Do not auto-choose image base. (default) --dll-search-prefix=<string> When linking dynamically to a dll without an importlib, use <string><basename>.dll in preference to lib<basename>.dll --enable-auto-import Do sophistcated linking of _sym to __imp_sym for DATA references --disable-auto-import Do not auto-import DATA items from DLLs --enable-runtime-pseudo-reloc Work around auto-import limitations by adding pseudo-relocations resolved at runtime. --disable-runtime-pseudo-reloc Do not add runtime pseudo-relocations for auto-imported DATA. --enable-extra-pe-debug Enable verbose debug output when building or linking to DLLs (esp. auto-import) --large-address-aware Executable supports virtual addresses greater than 2 gigabytes --enable-long-section-names Use long COFF section names even in executable image files --disable-long-section-names Never use long COFF section names, even in object files --dynamicbase Image base address may be relocated using address space layout randomization (ASLR) --forceinteg Code integrity checks are enforced --nxcompat Image is compatible with data execution prevention --no-isolation Image understands isolation but do not isolate the image --no-seh Image does not use SEH. No SE handler may be called in this image --no-bind Do not bind this image --wdmdriver Driver uses the WDM model --tsaware Image is Terminal Server aware Report bugs to <http://www.sourceware.org/bugzilla/> gcc -B/usr/local/src/trunk/objdir-binutils/ld/tmpdir/gas/ - I/usr/local/src/trunk/src/ld/testsuite/ld-gc -g -O2 - L/usr/local/src/trunk/objdir-binutils/./ld -c -g -O2 -ffunction-sections - fdata-sections -c /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c -o tmpdir/gc.o Executing on host: sh -c {gcc -B/usr/local/src/trunk/objdir- binutils/ld/tmpdir/gas/ -I/usr/local/src/trunk/src/ld/testsuite/ld-gc -g - O2 -L/usr/local/src/trunk/objdir-binutils/./ld -c -g -O2 -ffunction- sections -fdata-sections -c /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c - o tmpdir/gc.o 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:1: warning: -ffunction- sections may affect debugging on some targets /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:1: warning: -ffunction- sections may affect debugging on some targets ERROR: /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c: compilation failed /usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcexe - L/usr/local/src/trunk/src/ld/testsuite/ld-gc --gc-sections -e main tmpdir/gc.o Executing on host: sh -c {/usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcexe -L/usr/local/src/trunk/src/ld/testsuite/ld-gc --gc-sections -e main tmpdir/gc.o 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] tmpdir/gc.o: In function `dummy_func': /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `_alloca' /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `__main' tmpdir/gc.o: In function `dummy_func': /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `_alloca' /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `__main' UNRESOLVED: Check --gc-section /usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcrexe - L/usr/local/src/trunk/src/ld/testsuite/ld-gc --gc-sections -q -e main tmpdir/gc.o Executing on host: sh -c {/usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcrexe -L/usr/local/src/trunk/src/ld/testsuite/ld-gc --gc-sections -q - e main tmpdir/gc.o 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] tmpdir/gc.o: In function `dummy_func': /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `_alloca' /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `__main' tmpdir/gc.o: In function `dummy_func': /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `_alloca' /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.c:37: undefined reference to `__main' FAIL: Check --gc-section/-q /usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcrel - L/usr/local/src/trunk/src/ld/testsuite/ld-gc -r --gc-sections -e main tmpdir/gc.o Executing on host: sh -c {/usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcrel -L/usr/local/src/trunk/src/ld/testsuite/ld-gc -r --gc-sections -e main tmpdir/gc.o 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] /usr/local/src/trunk/objdir-binutils/ld/../binutils/nm-new tmpdir/gcrel >tmpdir/nm.out Executing on host: sh -c {/usr/local/src/trunk/objdir- binutils/ld/../binutils/nm-new tmpdir/gcrel 2>ld.stderr} /dev/null tmpdir/nm.out (timeout = 300) spawn [open ...] 00000004 b .bss 00000010 d .data 00000000 d .data$unused_var 00000000 d .data$used_var 00000004 N .stab 000002b0 N .stabstr 00000000 t .text 00000000 t .text$dummy_func 00000000 t .text$main 00000000 t .text$unused_func 00000000 t .text$used_func U ___main U __alloca 00000000 T _dummy_func 00000000 T _main 00000000 T _unused_func 00000000 D _unused_var 00000000 T _used_func 00000000 D _used_var 00000000 T main 00000000 T used_func unused section still here FAIL: Check --gc-section/-r/-e /usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcrel - L/usr/local/src/trunk/src/ld/testsuite/ld-gc -r --gc-sections -u used_func tmpdir/gc.o Executing on host: sh -c {/usr/local/src/trunk/objdir-binutils/ld/ld-new -o tmpdir/gcrel -L/usr/local/src/trunk/src/ld/testsuite/ld-gc -r --gc-sections -u used_func tmpdir/gc.o 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] /usr/local/src/trunk/objdir-binutils/ld/../binutils/nm-new tmpdir/gcrel >tmpdir/nm.out Executing on host: sh -c {/usr/local/src/trunk/objdir- binutils/ld/../binutils/nm-new tmpdir/gcrel 2>ld.stderr} /dev/null tmpdir/nm.out (timeout = 300) spawn [open ...] 00000004 b .bss 00000010 d .data 00000000 d .data$unused_var 00000000 d .data$used_var 00000004 N .stab 000002b0 N .stabstr 00000000 t .text 00000000 t .text$dummy_func 00000000 t .text$main 00000000 t .text$unused_func 00000000 t .text$used_func U ___main U __alloca 00000000 T _dummy_func 00000000 T _main 00000000 T _unused_func 00000000 D _unused_var 00000000 T _used_func 00000000 D _used_var 00000000 T main 00000000 T used_func unused section still here FAIL: Check --gc-section/-r/-u /usr/local/src/trunk/objdir-binutils/ld/../gas/as-new -o tmpdir/dump0.o /usr/local/src/trunk/src/ld/testsuite/ld-gc/noent.s Executing on host: sh -c {/usr/local/src/trunk/objdir-binutils/ld/../gas/as- new -o tmpdir/dump0.o /usr/local/src/trunk/src/ld/testsuite/ld-gc/noent.s 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] ./ld-new -L/usr/local/src/trunk/src/ld/testsuite/ld-gc --gc-sections -r -o tmpdir/dump tmpdir/dump0.o Executing on host: sh -c {./ld-new -L/usr/local/src/trunk/src/ld/testsuite/ld- gc --gc-sections -r -o tmpdir/dump tmpdir/dump0.o 2>&1} /dev/null ld.tmp (timeout = 300) spawn [open ...] /usr/local/src/trunk/objdir-binutils/ld/./.libs/ld-new: gc-sections requires either an entry or an undefined symbol failed with: </usr/local/src/trunk/objdir-binutils/ld/./.libs/ld-new: gc- sections requires either an entry or an undefined symbol>, expected: <gc- sections requires either an entry or an undefined symbol> /usr/local/src/trunk/objdir-binutils/ld/./.libs/ld-new: gc-sections requires either an entry or an undefined symbol PASS: --gc-sections -r without -e testcase /usr/local/src/trunk/src/ld/testsuite/ld-gc/gc.exp completed in 11 seconds This is on Windows XP Pro/SP3 cygwin Pentium M processor 2.13GHz system with packages: binutils 20080624-2 2.18.50.20080625 bison 2.3-1 2.3 cygwin 1.5.25-15 dejagnu 20021217-2 1.4.2.x expect 20030128-1 5.26 gcc-ada 3.4.4-999 gcc-core 3.4.4-999 gcc-g++ 3.4.4-999 gmp 4.2.4-1 libgmp-devel 4.2.4-1 libmpfr-devel 2.4.1-1 make 3.81-2 mpfr 2.4.1-1 tcltk 20080420-1 8.4 w32api 3.13-1 LAST_UPDATED: daily snapshot 2009-03-23: 2.19.51.20090323
GC is only implemented OOTB for Elf targets, and also apparently for XCOFF, from where it might be possible to backport the support to plain COFF and PE.
Created attachment 3859 [details] Do not assume that garbage collection is available on cygwin targets.
Hi Christian, Since garbage collection is not currently implemented for Cygwin toolchains the linker testsuite ought to skip the gc tests for this target. So please could you try out the uploaded patch to update the check_gc_sections_available procedure in the linker test library. Cheers Nick
Hi Nick, === ld tests === @@ -343,10 +343,6 @@ Running /usr/build/src-binutils/ld/tests Running /usr/build/src-binutils/ld/testsuite/ld-frv/frv-elf.exp ... Running /usr/build/src-binutils/ld/testsuite/ld-frv/tls.exp ... Running /usr/build/src-binutils/ld/testsuite/ld-gc/gc.exp ... -FAIL: Check --gc-section -FAIL: Check --gc-section/-q -FAIL: Check --gc-section/-r/-e -FAIL: Check --gc-section/-r/-u Running /usr/build/src-binutils/ld/testsuite/ld-h8300/h8300.exp ... Running /usr/build/src-binutils/ld/testsuite/ld-i386/i386.exp ... Running /usr/build/src-binutils/ld/testsuite/ld-ia64/ia64.exp ... @@ -426,8 +422,8 @@ Running /usr/build/src-binutils/ld/tests === ld Summary === -# of expected passes 77 -# of unexpected failures 6 +# of expected passes 76 +# of unexpected failures 2 # of expected failures 7 # of unsupported tests 2 /usr/build/obj-binutils/ld/ld-new 2.19.51.20090401 admin@ubik /usr/build/obj-binutils Your patch works fine, please commit it. The loss of one PASS is caused by the removal of the "--gc-sections -r without -e" test, which was emitting the appropriate error message even though gc would not have been performed even with the required -e (or -u) flag.
Subject: Bug 9987 CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2009-04-02 09:34:22 Modified files: ld/testsuite : ChangeLog ld/testsuite/lib: ld-lib.exp Log message: PR 9987 * lib/ld-lib.exp (check_gc_sections_available): Do not run garbage collection tests for cygwin targets. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1064&r2=1.1065 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/testsuite/lib/ld-lib.exp.diff?cvsroot=src&r1=1.61&r2=1.62
Hi Guys, OK - I have applied my patch. I will close this issue now since the problem - ld testsuite failures - has been addressed. The enhancement - supporting garbage collection in cygwin targeted toolchains - can be documented in this PR if/when it is ever implemented. Cheers Nick