Fix -nopie/-nopie check.
We don't use lgcc_s but missing lgcc_s or another library cause test to fail. So use -nostdlib. We need to use -Werror to avoid warning-generated case to be accepted. Clang uses -nopie rather than -no-pie. Check both and use whichever one works. Additionally android clang passes -pie to the linker even though it doesn't define __PIE__. So if compilation without no-pie logic fails add -nopie/-no-pie even if __PIE__ is not defined.
This commit is contained in:
parent
6371e9c104
commit
b53f595b3e
2 changed files with 45 additions and 3 deletions
12
configure.ac
12
configure.ac
|
@ -1202,13 +1202,21 @@ CFLAGS="$TARGET_CFLAGS"
|
|||
# Position independent executable.
|
||||
grub_CHECK_PIE
|
||||
grub_CHECK_NO_PIE
|
||||
grub_CHECK_NO_PIE_ONEWORD
|
||||
grub_CHECK_LINK_PIE
|
||||
[# Need that, because some distributions ship compilers that include
|
||||
# `-fPIE' or '-fpie' and '-pie' in the default specs.
|
||||
if [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
|
||||
fi
|
||||
if [ x"$nopie_possible" = xyes ] && [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie"
|
||||
|
||||
if [ x"$link_nopie_needed" = xyes ] || [ x"$pie_possible" = xyes ]; then
|
||||
if [ x"$nopie_possible" = xyes ]; then
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie"
|
||||
fi
|
||||
if [ x"$nopie_oneword_possible" = xyes ]; then
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -nopie"
|
||||
fi
|
||||
fi]
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue