forked from OSchip/llvm-project
[ELF] --gc-sections: Work around SHT_PROGBITS .init_array
Older Go cmd/link used SHT_PROGBITS for .init_array . Work around the lack of https://golang.org/cl/373734 for a while. It does not generate .fini_array or .preinit_array
This commit is contained in:
parent
e03ce65190
commit
48161b7490
|
@ -177,8 +177,10 @@ static bool isReserved(InputSectionBase *sec) {
|
|||
// SHT_NOTE sections in a group are subject to garbage collection.
|
||||
return !sec->nextInSectionGroup;
|
||||
default:
|
||||
// Support SHT_PROGBITS .init_array for a while
|
||||
// (https://golang.org/issue/50295).
|
||||
StringRef s = sec->name;
|
||||
return s == ".init" || s == ".fini" || s == ".jcr" ||
|
||||
return s == ".init" || s == ".fini" || s == ".init_array" || s == ".jcr" ||
|
||||
s.startswith(".ctors") || s.startswith(".dtors");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
# NOGC: Name: .tbss
|
||||
# NOGC: Name: .ctors
|
||||
# NOGC: Name: .dtors
|
||||
# NOGC: Name: .init_array
|
||||
# NOGC: Name: .preinit_array
|
||||
# NOGC: Name: .jcr
|
||||
# NOGC: Name: .jcr_x
|
||||
# NOGC: Name: .debug_pubtypes
|
||||
|
@ -49,6 +51,8 @@
|
|||
# GC1: Name: .tbss
|
||||
# GC1: Name: .ctors
|
||||
# GC1: Name: .dtors
|
||||
# GC1: Name: .init_array
|
||||
# GC1: Name: .preinit_array
|
||||
# GC1: Name: .jcr
|
||||
# GC1: Name: .debug_pubtypes
|
||||
# GC1: Name: .comment
|
||||
|
@ -71,6 +75,8 @@
|
|||
# GC2: Name: .tbss
|
||||
# GC2: Name: .ctors
|
||||
# GC2: Name: .dtors
|
||||
# GC2: Name: .init_array
|
||||
# GC2: Name: .preinit_array
|
||||
# GC2: Name: .jcr
|
||||
# GC2: Name: .debug_pubtypes
|
||||
# GC2: Name: .comment
|
||||
|
@ -147,6 +153,10 @@ h:
|
|||
.section .fini,"ax"
|
||||
.quad 0
|
||||
|
||||
# https://golang.org/cl/373734
|
||||
.section .init_array,"aw",@progbits
|
||||
.quad 0
|
||||
|
||||
.section .preinit_array,"aw",@preinit_array
|
||||
.quad 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue