Forgotten script attached. On Wed, Aug 07, 2019 at 08:35:09PM +0200, tlaronde wrote: > Description: the linker complains about string offsets in .strtab that > are pass the end of the section. This can be seen equally with a > cross-linker or a native linker on earmv7hf. > > How to reproduce: this is triggered by the use of the: > > -Wl,-retain-symbols-file -Wl,./some_exported_list > > This can be tested with dummy modules (the script joined allows to > create a variable number of modules---the "from" and "to" decimal > numbers of first and last letter---with an alphabetical letter as > name, and as the name of a function inside the dummy; by default, it > creates 'a' to 'd' C files; it suffices to exhibit the problems). > > Scope: it seemed to be only a debug problem at first since the .strtab > section is only used in this case. But it could trigger more profound > problems if a symbol is 'a' or 'd' conflicting with "$a" and "$d". In > some cases (this is not constant), even 'c' disappears. > > First analysis: when a symbol is named 'a' or 'd', even if explicitely > exported, it never appears in the .strtab; but '$a' and '$d' are > always there. > > In the export table, except (always) symbols named 'a' or 'd' (that > never appear), the only strings are '$a', '$d' and the strings present > in the exported_list given as an argument to the "-retain-symbols-file". > > But some strings that are still associated with some symbols are not > present and these are the ones the linker complains about. > > In the simplest case, the addition of '$d' can mask the symptoms (no > more complaints of the linker) because some missing strings are the > c source file names ($module.c) and some functions present in the crt* > modules, and these are associated with '$d'. But in pkgsrc > security/p11-kit, when more libraries are linked against the library > created, some strings are still missing (for the linker) even when > adding '$d' to the exported list. > > What's next? I will have some spare time next week and will tackle > the problem on the ld source level. But I have only the knowledge given > by John R. Levine's "Linkers & Loaders" book, and I have never dived in > the binutils sources. So if this rings a bell to someone more > knowledgeable who can tackle the problem himself... > > At the very least, I would like to be pointed to some > documentation, particularily about what are these special symbols '$a' > '$d' (and '$t' and what else?) and what is special about the earmv7 > case. > > HTH, > -- > Thierry Laronde <tlaronde +AT+ polynum +dot+ com> > http://www.kergis.com/ > http://www.sbfa.fr/ > Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C -- Thierry Laronde <tlaronde +AT+ polynum +dot+ com> http://www.kergis.com/ http://www.sbfa.fr/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Attachment:
compile.sh
Description: Bourne shell script