this patch adds extra functionality to brandelf so it's able to brand all elf types defined by POSIX.1-2008.
the patchset has been discussed in this thread:
some people liked the idea of brandelf being extended this way, while others disliked the idea due to the fact that freebsd itself isn't able to run any elf binaries apart from FreeBSD(9) Linux(3) Solaris(6) SVR4(0).
personally i didn't see the connection between brand'elfing binaries and running them. brandelf's purpose also includes simply branding binaries without running them. think of a bunch of NetBSD/OpenBSD/... files which should be backup'ed under FreeBSD, but are brandelf'ed improperly. in this case the patch would come in handy.
Fix: Patch attached with submission follows:
As I noted in private to Alexander, the elftoolchain
project has a better implementation that:
- Uses libelf
- Takes advantage of the FreeBSD headers
thanks for the reply.
indeed the libelf project has a much better implementation of brandelf than
the one in the freebsd base dir.
hopefully at some point the libelf project's work will be included into the
base dir and replace most of the gnu (or even pre-gnu) elf binaries/libraries.
however until then i don't see why existing code - although inferior to the
libelf project's code - shouldn't be enhanced here and there.
also it's a lot easier to find a committer to add a few changes to an app
which obviously won't break stuff than to find somebody to replace an existing
binary with a whole new one.
so i completely agree with you. i'm looking forward to seeing libelf's work in
the base dir, but until then time (or better yet code) doesn't have to stand
The code is not too different. I am OK with seeing your patch go in too.
Brandelf along with other elf-related tools will eventually be replaced by
importing the BSD-licensed elftoolchain project into the FreeBSD tree.
Once the import occurs this PR should be re-evaluated.
The patch can go in and be merged into ELF Tool Chain's copy from FreeBSD.
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017
- Set Status to "Open"