STB_WEAK in ELF symbol tables
Posted: Mon Feb 16, 2015 10:11 am
Hi,
in the process of writing my assembler I read through the ELF spec to familiarize myself with the structure of such a file and make my assembler output valid ELF binaries. I figured out the File Header, the Program Header and the Section Header Table. Now, I'm working on adding a symbol table. I ran into a question at figure 1-17 (page 24) in the spec at skyfree.org: I understand that STB_LOCAL marks a symbol local, i.e. it's only visible to the object file it's located in. STB_GLOBAL makes a symbol visible to every object file that is linked with the one the symbol is in. STB_WEAK is like STB_GLOBAL, but that it may be overridden by a STB_GLOBAL symbol.
The question here is whether STB_WEAK is actually used or just something the ELF spec proposes but isn't really used. Should I care about it or just neglect it for my assembler?
in the process of writing my assembler I read through the ELF spec to familiarize myself with the structure of such a file and make my assembler output valid ELF binaries. I figured out the File Header, the Program Header and the Section Header Table. Now, I'm working on adding a symbol table. I ran into a question at figure 1-17 (page 24) in the spec at skyfree.org: I understand that STB_LOCAL marks a symbol local, i.e. it's only visible to the object file it's located in. STB_GLOBAL makes a symbol visible to every object file that is linked with the one the symbol is in. STB_WEAK is like STB_GLOBAL, but that it may be overridden by a STB_GLOBAL symbol.
The question here is whether STB_WEAK is actually used or just something the ELF spec proposes but isn't really used. Should I care about it or just neglect it for my assembler?