[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/22677] ld -r --gc-collect does not KEEP .init_array/.fini_array
From: |
address@hidden |
Subject: |
[Bug ld/22677] ld -r --gc-collect does not KEEP .init_array/.fini_array |
Date: |
Fri, 05 Jan 2018 09:52:33 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=22677
--- Comment #1 from David Leonard <address@hidden> ---
Submitted too early, sorry. I mean --gc-section not --gc-collect.
Example
$ cat L.c
int L4var = 4;
int L5var;
int L5init() {
L5var = 5;
}
__attribute__((constructor))
static void Lconstructor() {
L5init();
}
$ gcc -ffunction-sections -fdata-sections -c -o L.o L.c
$ ld -r --gc-section L.o -u L4var -o libL.o
$ nm libL.o
0000000000000000 D L4var
With workaround:
$ ld -r --gc-section L.o -u L4var -o libL.o fixup.ldscript
ld: warning: fixup.ldscript contains output sections; did you forget -T?
$ nm libL.o
0000000000000000 D L4var
0000000000000000 T L5init
0000000000000004 C L5var
0000000000000000 t Lconstructor
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/22677] New: ld -r --gc-collect does not KEEP .init_array/.fini_array, address@hidden, 2018/01/05
- [Bug ld/22677] ld -r --gc-collect does not KEEP .init_array/.fini_array,
address@hidden <=
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, address@hidden, 2018/01/05
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, nickc at redhat dot com, 2018/01/08
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, address@hidden, 2018/01/10
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, nickc at redhat dot com, 2018/01/11
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, cvs-commit at gcc dot gnu.org, 2018/01/11
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, hjl.tools at gmail dot com, 2018/01/11
- [Bug ld/22677] ld -r --gc-section does not KEEP .init_array/.fini_array, address@hidden, 2018/01/11