Page MenuHomeFreeBSD

Adding well-known ELF note values in elf_common.h
Needs ReviewPublic

Authored by naito.yuichiro_gmail.com on Aug 30 2019, 1:35 AM.

Details

Reviewers
emaste
Summary

This patch solves https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239669.
And I found imgact_elf.c refers to ELF note values, it seems same values of my patch.
I think static values should be defined in the header file.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

Thank you for the submission - I committed a portion of the new #defines in rS352551.

sys/sys/elf_common.h
818–823

Do these #defines match a Linux header? These are GNU-specific #defines, and unless we specifically choose to use these for compatibility they ought to have GNU in the name.

sys/sys/elf_common.h
818–823

I say yes about following definitions.

ELF_NOTE_OS_LINUX
ELF_NOTE_OS_GNU
ELF_NOTE_OS_SOLARIS2
ELF_NOTE_OS_FREEBSD.

And say No about ELF_NOTE_OS_NETBSD. It's my creation.

I refered to NetBSD's sys/sys/exec_elf.h.
NetBSD defines as follows.

/* GNU-specific OS/version value stuff */
#define ELF_NOTE_ABI_OS_LINUX           0
#define ELF_NOTE_ABI_OS_HURD            1
#define ELF_NOTE_ABI_OS_SOLARIS         2
#define ELF_NOTE_ABI_OS_KFREEBSD        3
#define ELF_NOTE_ABI_OS_KNETBSD         4

I don't have specific reason to keep compatibility to GNU for these definitions.
Following NetBSD definition seems good in this point.

But we have already followed GNU's definition for ELF note names.
(e.g. #define ELF_NOTE_GNU "GNU")

It will make our elf_common.h consitent by keeping compatibility to GNU.
(e.g. NetBSD defines #define ELF_NOTE_GNU_NAME "GNU\0")