Repository navigation
Compile for the host when no target is named, as GCC and clang do - #198
Merged
Merged
Conversation
`embcc hello.c -o hello` built for x86_64-elf, a freestanding kernel
target, whatever the machine was. On a Mac it then failed to link
("entry symbol '_start' is undefined"). GCC and clang build for the host
when nothing names a target, and EmbCC now does too: aarch64-apple-darwin
on an arm64 Mac, x86_64-apple-darwin on an Intel one, x86_64-linux-gnu
or aarch64-linux-gnu on Linux, x86_64-windows-gnu on Windows, and
x86_64-emblink for the compiler EmbCC builds for EmbLinkOS. The host is
read from the compiler that built EmbCC, so the default is baked in, as
GCC's is. On a host with no hosted target, or in a compiler built
without that host's family (make TARGETS=), it is x86_64-elf or the
first family built, as before. EMBCC_DEFAULT_TARGET, a compiled-in
DEFAULT_TARGET and --target= still win, in that order.
What relied on the old default now names it: check-self, libcxx-x86_64,
tools/gen-selfhost-ref.sh and tools/os-stage.sh. tests/run.sh exports
EMBCC_DEFAULT_TARGET=x86_64-elf, because the suite's tests were written
against x86_64-elf as the target nothing names, and name every other
one. default-target.sh unsets it and expects the host. The manual, the
README and the roadmap say so, and the roadmap's open decision is
closed.
EmbLinkOS's mathself recipe calls embcc with no --target= and needs
--target=x86_64-elf (its Makefile, lines 1616-1618).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
embccwith no--target=now compiles for the machine it runs on, as GCC and clang do. It used to build forx86_64-elf, a freestanding kernel target, soembcc hello.c -o hellofailed to link on a Mac.aarch64-apple-darwinx86_64-apple-darwinx86_64-linux-gnu/aarch64-linux-gnux86_64-windows-gnux86_64-emblinkEMBCC_DEFAULT_TARGET,make DEFAULT_TARGET=and--target=still win, in that order.make TARGETS=), the old fallback applies.--target=x86_64-elf:check-self,libcxx-x86_64,gen-selfhost-ref.shandos-stage.sh.tests/run.shpins the suite tox86_64-elf, as its tests were written against it.default-target.shchecks the new rule.EmbLinkOS needs one change before this merges: its
mathselfrecipe (Makefile lines 1616–1618) calls$(HOST_EMBCC) -c …with no--target=and must add--target=x86_64-elf.