Page MenuHomeFreeBSD

Allow bootstrapping elftoolchain on MacOS and Linux

Authored by arichardson on Aug 17 2018, 2:55 PM.



This is required in order to build on non-FreeBSD systems without setting
all the XAR/XSTRINGS/etc. variables

Test Plan

Builds on Linux/Mac

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Generally looks fine to me.

84 ↗(On Diff #46841)

Only style suggestion I have here is that a tab after the '+=' seems to be the style used in this file. I suspect Ed probably better understands if always using this on Linux is correct since he wrote the script, so I'll give him a chance to speak up before digging to understand why we only need this for Linux and not for other platforms.

emaste added inline comments.
375–380 ↗(On Diff #49874)

We will want to coordinate with upstream ELF Tool Chain for these - CC @kaiw and

84 ↗(On Diff #46841)

For Apple, FreeBSD, etc. in _libelf_config.h we have a #if defined(__amd64__) ... #elif defined(__aarch64__) ... tree to #define LIBELF_ARCH and such. This is not done for Linux; I'm not sure why.

84 ↗(On Diff #46841)

Actually, let's start fixing this in the in-tree FreeBSD headers and we can move this upstream after.

There are only three variables that need to be set, and only three known architectures in native-elf-format so we should be able to use an #if defined() tree for Linux also with equivalent functionality.

81 ↗(On Diff #49874)

Stock Elftoolchain sources should build out of the box on Linux though.

81 ↗(On Diff #49874)

Indeed, but (as with all contrib software in FreeBSD) we have bespoke Makefiles and don't use the upstream build infrastructure. native-elf-format.h is only needed when building on Linux I believe, and other archs use #ifdef (__x86_64__) etc. I don't object to the change here but think it would be better to just avoid needing native-elf-format.h altogether.

81 ↗(On Diff #49874)

I will look at moving to a #ifdef based scheme for Linux based hosts (elftoolchain ticket #563).

@arichardson I'm fine with this change in FreeBSD (if we end up with a different approach upstream we can just migrate to it on the next elftoolchain update).

This revision is now accepted and ready to land.Nov 23 2018, 1:56 AM