Pass correct emulation string to gold

Gold recognizes a different set of emulation strings to specify targets
than the bfd linker accepts. Clang only passes bfd emulations to the
linker, so we need to override these with the versions accepted by gold
when using gold.

Gold normally picks up the correct target from the first ELF input file
if it cannot parse the emulation parameter. However when using LTO, all
objects may be bitcode files, which causes gold to rely on the passed
--oformat or -m parameter to determine the proper target. If gold cannot
parse the emulation string passed by clang, it fails to link.

Test: build LTO version of libc

Change-Id: I38e78bb912fd3cc5fb7b4a762284f50ddd4f3998
This commit is contained in:
Stephen Crane 2017-06-26 19:22:02 -07:00
parent 38d3d5d2e5
commit b3c2154f2a
2 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,7 @@ var (
"-Wl,--build-id=md5",
"-Wl,--warn-shared-textrel",
"-Wl,--fatal-warnings",
"-Wl,-maarch64linux",
"-Wl,-m,aarch64_elf64_le_vec",
"-Wl,--hash-style=gnu",
"-Wl,--fix-cortex-a53-843419",
"-fuse-ld=gold",

View File

@ -67,6 +67,7 @@ var (
"-Wl,--icf=safe",
"-Wl,--hash-style=gnu",
"-Wl,--no-undefined-version",
"-Wl,-m,armelf",
}
armArmCflags = []string{