Subject: Re: Reworking ELF to be "normal-looking"
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Christos Zoulas <firstname.lastname@example.org>
Date: 01/31/1999 07:21:52
On Jan 30, 4:54pm, jonathan@DSG.Stanford.EDU (Jonathan Stone) wrote:
-- Subject: Reworking ELF to be "normal-looking"
| [please cc: me on any replies]
| Does anyone know why NetBSD's userland ELF definitions are so
| different from the ones third-party code (eg., emacs) expects?
| We use enums for the values defined for ELF header fields, with like
| ELf_pt_* for program headers, Elf_sht_* for section headers, etc.
| Emacs, binutils (and other code? expects `standard' SVR4 names, and
| has to rename them to get otherwise-portable code to compile, viz:
| # define PT_LOAD Elf_pt_load
| # define SHT_SYMTAB Elf_sht_symtab
| # define SHT_DYNSYM Elf_sht_dynsym
| # define SHT_NULL Elf_sht_null
| # define SHT_NOBITS Elf_sht_nobits
| # define SHT_REL Elf_sht_rel
| # define SHT_RELA Elf_sht_rela
| # define SHN_UNDEF Elf_eshn_undefined
| # define SHN_ABS Elf_eshn_absolute
| # define SHN_COMMON Elf_eshn_common
| emacs uses thees, plus HDRR, pHDRR and ElfW.
| Are these mandated by ELF "standards", or just conventional? What're
| the pros and cons of providing these (and the rest of the equivalents
| in libbfd's elf/common.h) in, say, sys/exec_elf.h?
I do, since I wrote them. At the time I wrote them, there was no standard.
I think that we should provide a <sys/elf.h> that has the standard names,
and eventually get rid of <sys/exec_elf.h>. Or have <sys/elf.h> include
<sys/exec_elf.h> and do the magic with the right defines. I like to use
enums better than #defines, because it makes it easier to debug things.