Page MenuHomeFreeBSD

Export eflags field from elf headers everywhere.
ClosedPublic

Authored by imp on May 21 2015, 7:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 18, 1:28 AM
Unknown Object (File)
Sat, Oct 12, 8:19 PM
Unknown Object (File)
Sat, Oct 12, 8:19 PM
Unknown Object (File)
Sat, Oct 12, 8:19 PM
Unknown Object (File)
Sat, Oct 12, 8:19 PM
Unknown Object (File)
Sat, Oct 12, 8:19 PM
Unknown Object (File)
Sat, Oct 12, 8:19 PM
Unknown Object (File)
Sat, Oct 12, 8:01 PM
Subscribers

Details

Summary

Export the eflags for architectures that want to use them. The current plan is only for ARM, but doing it now, generically will allow us greater flexibility if we want to do other architectures in the future.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp retitled this revision from to Export eflags field from elf headers everywhere..
imp updated this object.
imp edited the test plan for this revision. (Show Details)
imp added reviewers: emaste, kib.

seems reasonable to me

sys/arm/include/elf.h
90 ↗(On Diff #5530)

tab vs space?

imp marked an inline comment as done.May 21 2015, 8:17 PM
imp added inline comments.
sys/arm/include/elf.h
90 ↗(On Diff #5530)

Fixed, but this file (and the similar ones) are a curious mix of spaces and tabs.

imp marked an inline comment as done.
imp updated this object.
imp edited edge metadata.

Fix tabs vs spaces issue

sys/arm/include/elf.h
66–80 ↗(On Diff #5532)

I know this is an unrelated change, but it makes things consistent with all the other architectures despite how AFUd phabricator makes it look.

Generally, yes, this is what we discussed, and it is fine. Still, there are some details that could be improved.

I suggest naming the aux entry AT_EHDRFLAGS. IMO E_FLAGS is too cryptic and underscore was not used in any other name.

Introducing the aux entry for all arches is a waste. There is no use of the e_flags for x86, and so far, there is no indication that any flags appear for non-arm arches. Only defining it on the arches where the flags are used, and then bracketing the imgact_elf.c fixup action with #ifdef AT_EHDRFLAGS is not too much burden. It is fine to have e_flags member of elf_auxargs always defined and initialized.

In D2611#48604, @kib wrote:

Generally, yes, this is what we discussed, and it is fine. Still, there are some details that could be improved.

I suggest naming the aux entry AT_EHDRFLAGS. IMO E_FLAGS is too cryptic and underscore was not used in any other name.

OK

Introducing the aux entry for all arches is a waste. There is no use of the e_flags for x86, and so far, there is no indication that any flags appear for non-arm arches. Only defining it on the arches where the flags are used, and then bracketing the imgact_elf.c fixup action with #ifdef AT_EHDRFLAGS is not too much burden. It is fine to have e_flags member of elf_auxargs always defined and initialized.

I believe that MIPS may also need this treatment if we ever want to support n32 and n64 binaries at the same time. I'll change the name and only define it for arm at the moment. The overhead is tiny and it may help solve some transition problems in the future. I don't see any current use for it on x86, though, and the uses on sparc and ppc seem to be not relevant. arm64 is an open question, but I'll defer there until we have more experience with the platform. I'm kinda torn on the mips question, but will defer on that until I can study the issue more closely.

imp edited edge metadata.

Do what kib@ suggested.

sys/kern/imgact_elf.c
1006 ↗(On Diff #5567)

This should be AT_EHDRFLAGS. And the next line too.

sys/sys/imgact_elf.h
55 ↗(On Diff #5567)

I understand that you followed the trend for other members, but Elf_Size instead of Elf_Word is weird.

Fix typos and use Elf_Word to match elf header definition...

kib edited edge metadata.

Looks fine, thanks.

This revision is now accepted and ready to land.May 22 2015, 8:44 PM
This revision was automatically updated to reflect the committed changes.