Subject: Reworking ELF to be "normal-looking"
To: None <tech-toolchain@netbsd.org, tech-userland@netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-toolchain
Date: 01/30/1999 16:54:50
[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?