bfd: 2007-11-16 Tristan Gingold * elflink.c (elf_link_output_extsym): Weaken assertion: if --gc-section is set, there may be no TLS segment. ld/testsuite: 2007-11-16 Tristan Gingold * ld-elf/tls_gc.s: New test. * ld-elf/elf.exp: Add tls_gc test. *** bfd/elflink.c 31 Oct 2007 07:36:46 -0000 1.285 --- bfd/elflink.c 16 Nov 2007 10:43:20 -0000 *************** elf_link_output_extsym (struct elf_link_ *** 8542,8549 **** { /* STT_TLS symbols are relative to PT_TLS segment base. */ ! BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL); ! sym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma; } } } --- 8542,8556 ---- { /* STT_TLS symbols are relative to PT_TLS segment base. */ ! asection *tls_sec = elf_hash_table (finfo->info)->tls_sec; ! if (tls_sec != NULL) ! sym.st_value -= tls_sec->vma; ! else ! { ! /* The TLS section may have been garbage collected. */ ! BFD_ASSERT (finfo->info->gc_sections ! && !input_sec->gc_mark); ! } } } } *** ld/testsuite/ld-elf/elf.exp 28 Aug 2007 13:21:57 -0000 1.12 --- ld/testsuite/ld-elf/elf.exp 16 Nov 2007 10:43:26 -0000 *************** if { [istarget *-*-linux*] } { *** 53,58 **** --- 53,66 ---- } } + # The following tests require --gc-section + if { ![istarget ia64-*-*] } { + run_ld_link_tests { + {"--gc-sections on tls variable" + "--gc-section" "" {tls_gc.s} {} "tls_gc"} + } + } + # The following tests require running the executable generated by ld. if ![isnative] { return *** /dev/null 2004-06-30 22:03:36.000000000 +0200 --- ld/testsuite/ld-elf/tls_gc.s 2007-11-16 11:08:40.000000000 +0100 *************** *** 0 **** --- 1,16 ---- + .globl main + .globl start + .globl _start + .globl __start + .text + main: + start: + _start: + __start: + .byte 0 + .globl var + .section .tbss.var,"awT",%nobits + .type var,%object + .size var,1 + var: + .zero 1