I'm reading up on ELF files from both System V ABI and Linux Standard Base specs. In regard to symbol table sections System V says
Currently, an object file may have only one section of each type, but this restriction may be relaxed in the future. Typically, SHT_SYMTAB provides symbols for link editing, though it may also be used for dynamic linking. As a complete symbol table, it may contain many symbols unnecessary for dynamic linking. Consequently, an object file may also contain a SHT_DYNSYM section, which holds a minimal set of dynamic linking symbols, to save space.
While LSB seems to disallow it explicitly
Currently, an object file may have either a section of SHT_SYMTAB type or a section of SHT_DYNSYM type, but not both. This restriction may be relaxed in the future. Typically, SHT_SYMTAB provides symbols for link editing, though it may also be used for dynamic linking. As a complete symbol table, it may contain many symbols unnecessary for dynamic linking.
So, the parts I've marked in bold directly contradict each other. At the same time, the parts I've italicised are verbatim copy of each other, which makes me suspect that LSB might have made an error (i.e. the bold part) while copying from System V?
Hence my question, which one is correct? Can an object file have both sections at the same time under linux?
The text you referenced appears to be from here.
It also appears to be totally bogus: it is exceptionally common for an ELF (shared) object to have both
SHT_SYMTAB
andSHT_DYNSYM
sections at the same time. Example: