Commit Graph

523 Commits

Author SHA1 Message Date
Vladimir Serbinenko b53f595b3e 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.
2017-01-30 19:38:55 +01:00
Vladimir Serbinenko d15f17b2a0 Support arm clang 3.8 amd later.
clang 3.8 and later doesn't support -mllvm -use-arm-movt=0
whereas older clang doesn't know -mno-movt. So use
-mno-movt whenever possible and fallback to mllvm variant.
2017-01-28 14:41:23 +00:00
Vladimir Serbinenko 79fc008935 Don't use -mlong-calls on arm.
We don't really need it and it's flaky and creates
bogus symbols with clang.
2017-01-27 18:48:25 +00:00
Vladimir Serbinenko bf9c561670 configure: Disable movw/movt with clang.
Those relocations are not compatible with PE and also
not compatible with custom uboot relocator.
Disable them.
2017-01-27 18:48:23 +00:00
Andrei Borzenkov 07662af7ae configure: fix check for sys/sysmacros.h under glibc 2.25+
glibc 2.25 still includes sys/sysmacros.h in sys/types.h but also emits
deprecation warning. So test for sys/types.h succeeds in configure but later
compilation fails because we use -Werror by default.

While this is fixed in current autoconf GIT, we really cannot force everyone
to use bleeding edge (that is not even released right now). So run test under
-Werror as well to force proper detection.

This should have no impact on autoconf 2.70+ as AC_HEADER_MAJOR in this version
simply checks for header existence.

Reported and tested by Khem Raj <raj.khem@gmail.com>
2016-12-22 22:48:25 +03:00
Magnus Granberg a3e9da054d configure: add check for -no-pie if the compiler default to -fPIE
When Grub is compile with gcc 6.1 that have --enable-defult-pie set.
It fail with.
-ffreestanding   -m32 -Wl,-melf_i386 -Wl,--build-id=none  -nostdlib -Wl,-N -Wl,-r,-d   -
o trig.module  trig_module-trigtables.o
grep 'MARKER' gcry_whirlpool.marker.new > gcry_whirlpool.marker; rm -f
gcry_whirlpool.marker.new
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and -
shared may not be used together
collect2: error: ld returned 1 exit status
Makefile:26993: recipe for target 'trig.module' failed

Check that compiler supports -no-pie and add it to linker flags.
2016-12-14 20:44:41 +03:00
Aaro Koskinen 0af7539bd2 configure.ac: don't require build time grub-mkfont on powerpc-ieee1275
Don't require build time grub-mkfont on powerpc-ieee1275.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
2016-11-22 20:41:34 +03:00
Mike Gilbert 7a5b301e3a build: Use AC_HEADER_MAJOR to find device macros
Depending on the OS/libc, device macros are defined in different
headers. This change ensures we include the right one.

sys/types.h - BSD
sys/mkdev.h - Sun
sys/sysmacros.h - glibc (Linux)

glibc currently pulls sys/sysmacros.h into sys/types.h, but this may
change in a future release.

https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
2016-04-24 08:12:42 +03:00
Andrei Borzenkov f4d35d49e3 configure: set -fno-pie together with -fno-PIE
OpenBSD 5.9 apparently defaults to -fpie. We use -fno-PIE when appropriate
already, but that is not enough - it does not turn off -fpie.

Actually check for -fPIE is not precise enough. __PIE__ is set for both
-fpie and -fPIE but with different values. As far as I can tell, both
options were introduced at the same time, so both should always be supported.

This fixes compilation on OpenBSD 5.9 which otherwise created insanely big
lzma_decompress.img.

Reported, suggested and tested by: Jiri B <jirib@devio.us>
2016-03-22 20:12:22 +03:00
Vladimir Serbinenko 8207874e5d Release 2.02~beta3 2016-02-28 03:07:41 +01:00
Vladimir Serbinenko 80fdaf1d01 configure.ac: Reorder efiemu check to after link format check.
efiemu is supposed to be disabled when compiling through exe format.
Unfortunately format was determined only after efiemu check. Reorder to fix the
problem
2015-12-31 22:36:23 +01:00
Vladimir Serbinenko 40051fedc3 configure: Add -fno-unwind-tables if supported.
Unwind tables are useless for us bt consume space if present. Ensure that they
are not.
2015-12-31 19:20:03 +01:00
Vladimir Serbinenko 5ae590b32d configure: Fix grub_cv_cc_fno_unwind_tables check.
Check tries -fno-dwarf2-cfi-asm but adds -fno-asynchronous-unwind-tables
to TARGET_CFLAGS. Fix this.
2015-12-31 18:19:15 +01:00
Vladimir Serbinenko f1b3525385 Add -mno-stack-arg-probe on mingw.
This argument disables generation of calls to __chkstk_ms. Those calls are
useless on GRUB as function is dummy. Yet they increase module size and
use limited-range relocations which may not work under some memory layouts.
We currently don't use such layouts on concerned platforms but lt's correct
this.
2015-12-31 18:15:49 +01:00
Andrei Borzenkov a261842785 configure: fix macports flex version detection
Macports add extra information after version itself:

$flex --version
flex 2.5.35 Apple(flex-31)

We require at least felx 2.5.35 so do not need to care about prehistoric
"flex version n.n.n"; just use second field always.

Reported by Peter Cheung <mcheung63@hotmail.com>
2015-11-27 19:42:23 +03:00
Vladimir Serbinenko cd6d79cda2 configure.ac: Explicitly add -mno-sse3 on x86. 2015-11-06 04:32:34 +01:00
Andrei Borzenkov a3645c1240 configure: find options to force endian on MIPS 2015-10-14 00:42:14 +02:00
Andrei Borzenkov be25d92196 configure: force o32 ABI on MIPS
GRUB code expects O32 or N32. N32 is less tested than O32, so we prefer to
compile with O32. Some systems (e.g. GNU Guix) default to using newer
n64 or n32 ABI. Try to find suitable options to force o32.

For GCC this is simply -mabi=32. While clang supports this option as well,
o32 ABI is valid for MIPS target and n32/64 ABI are valid for MIPS64 target
only, so use "-target mips/mipsel -mabi=32".

Reported-By: Mark H Weaver <mhw@netris.org>
Also-By: Mark H Weaver <mhw@netris.org>
2015-10-14 00:39:15 +02:00
Vladimir Serbinenko ca73ae446c arm-emu: Add __aeabi_memcpy* and __aeabi_memclr* symbols.
Fixes compilation with clang.
2015-07-23 02:15:46 +02:00
Vladimir Serbinenko 5c46165a7c configure.ac: Handle powerpc64le compiler
Also-by: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
2015-07-22 01:54:59 +02:00
Leif Lindholm 43d4231432 configure.ac: clean up arm64 soft-float handling
Fix compilation with gcc 5.1 (avoid internal compiler error), by
replacing explicit -march +nofp+nosimd options with -mgeneral-regs-only.

This also enables the removal of some further conditional build flag
setting.
2015-06-02 15:41:09 +01:00
Vladimir Serbinenko 5959b15c1c configure.ac: Fix the name of pciaccess header. 2015-03-04 01:01:45 +01:00
Vladimir Serbinenko 9d25b0da9a Remove emu libusb support.
It's disabled by default and has been broken for a long time.
As nobody is interested in fixing and maintaining it, remove it.
2015-03-03 20:59:36 +01:00
Vladimir Serbinenko 9f95d12153 configure.ac: Remove unused COND_clang 2015-03-03 20:50:37 +01:00
Vladimir Serbinenko 064360e667 Remove libgcc dependency.
libgcc for boot environment isn't always present and compatible.
libgcc is often absent if endianness or bit-size at boot is different
from running OS.
libgcc may use optimised opcodes that aren't available on boot time.
So instead of relying on libgcc shipped with the compiler, supply
the functions in GRUB directly.
Tests are present to ensure that those replacement functions behave the
way compiler expects them to.
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko aa6ccc05c1 configure.ac: Set $CPPFLAGS when checking for no_app_regs.
Fixes compilation for sparc64 with clang.
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko 6a4ecd276e mips: Fix soft-float handling.
Add -msoft-float alongside clang arguments to specify ABI.
Specify ABI in asm files explicitly.
This trigers asm warning due to gcc failing to propagate -msoft-float
but it's tolerable.
2015-02-23 22:33:28 +01:00
Vladimir Serbinenko 2066c35b3f Allow clang compilation for thumb with -mthumb-interwork.
clang already uses -mthumb-interwork behaviour even thout it doesn't
support the option.
2015-02-23 22:29:33 +01:00
Vladimir Serbinenko 345076a78a arm64: Fix compilation failure.
Don't supply +nosimd to asm files.
Otherwise +nosimd coming from flags forbids some of instructions
used in cache_flush.
2015-02-23 22:29:28 +01:00
Vladimir Serbinenko ea39b87a8b configure.ac: Add ia64-specific way to disable floats. 2015-02-22 14:42:19 +01:00
Vladimir Serbinenko 155f334f57 Experimental support for clang for sparc64.
Automatically discover command line options to make clang and
gcc behave in same way.

Tested with qemu.
2015-02-22 01:54:55 +01:00
Vladimir Serbinenko ebe316e4df Discover which option provides soft-float on configure stage.
Deals with clang needing other arguments to stop issuing floating
instructions than gcc.
2015-02-22 00:35:11 +01:00
Vladimir Serbinenko f16b8c0405 Relax requirements on asm for non-BIOS i386 platforms.
These platforms don't have a hard limit on size of resulting code16
code, so we don't care if assembly is bigger than necessarry.
2015-02-21 20:18:18 +01:00
Vladimir Serbinenko 6505b241fd Remove obsolete ADDR32 and DATA32 checks. 2015-02-21 17:44:41 +01:00
Vladimir Serbinenko 065ad910f1 Test which flags make our asm compile.
Previously we relied on assumption that clang always needs -no-integrated-as
but it's not always true.
2015-02-21 16:29:28 +01:00
Vladimir Serbinenko ef7c843b44 configure: Add -msoft-float to CCASFLAGS
Otherwise mismatch between API flags triggers linker failure
2015-02-21 16:13:11 +01:00
Vladimir Serbinenko b46bf3cd1c configure: Move adding of include options to the very end to avoid subshell. 2015-02-20 21:30:34 +01:00
Vladimir Serbinenko 86f05f1491 configure: Add missing comma. 2015-02-20 21:29:35 +01:00
Leif Lindholm 2da4171eab configure.ac: don't use -msoft-float for arm64
aarch64 toolchains do not support the -msoft-float option added by
commit 3661261f. Insted, for arm64 use -march=armv8-a+nofp+nosimd.

Reported-by: Ryan Harkin <ryan.harkin@linaro.org>
2015-01-28 20:44:41 +00:00
Vladimir Serbinenko fc7a64bc5a configure.ac: Always add -D_FILE_OFFSET_BITS=64. 2015-01-26 09:35:44 +01:00
Vladimir Serbinenko 3661261fe1 Always add -msoft-float to avoid compiler generating float arithmetics. 2015-01-24 20:37:08 +01:00
Felix Janda 3bac4caa2b Remove direct _llseek code and require long filesystem libc. 2015-01-22 19:54:36 +01:00
Colin Watson 77063f4cb6 Fix in-tree --platform=none
* configure.ac: Only remove include/grub/cpu and
include/grub/machine in the --platform=none case, not all of
include/grub.
2014-09-25 20:59:26 +01:00
Colin Watson 5d90f6e533 Add a new "none" platform that only builds utilities
This makes it possible to build generally-useful utilities such as
grub-mount even if the rest of GRUB has not been ported to the target
CPU.

* configure.ac: Add "none" platform.  Default to it for unsupported
CPUs rather than stopping with a fatal error.  Don't downgrade
x86_64-none to i386.  Define COND_real_platform Automake conditional
if the platform is anything other than "none".  Don't do any include
directory linking for "none".
* Makefile.am: Skip building grub-core and all bootcheck targets if
!COND_real_platform.
* include/grub/time.h: Don't include <grub/cpu/time.h> if GRUB_UTIL
is defined.
2014-09-23 12:06:30 +01:00
Colin Watson 2a5a532c00 Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
* configure.ac: Remove -m64 from checks for -mcmodel=large and
-mno-red-zone.  These are always either unnecessary (x86_64-emu) or
already in TARGET_CFLAGS at this point, and they produce incorrect
results when building for x32.
* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast
pointers to Elf64_Xword via grub_addr_t, in order to work on x32.
* include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P,
GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32.
2014-09-07 23:04:50 +01:00
Colin Watson 4d94b2db58 * configure.ac: Remove several unnecessary semicolons. 2014-09-07 20:47:43 +01:00
Andrey Borzenkov 443b322262 Show detected path to DejaVuSans in configure summary 2014-01-21 19:41:11 +04:00
Andrey Borzenkov 36387ece6b look for DejaVu also in /usr/share/fonts/truetype
It is installed in this path on openSUSE.
2014-01-21 19:29:33 +04:00
Andrey Borzenkov 1ecf96fcc4 add BUILD_EXEEXT support to fix make clean on Windows
Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
appropriate.
2014-01-18 20:41:24 +04:00
Andrey Borzenkov dcecae1a49 reintroduce BUILD_LDFLAGS for the cross-compile case
This allows providing separate LDFLAGS for build and host environments, which
are not necessary the same for cross-compile case. In particular, it allows
building host programs statically to not depend on presence of libraries at
run-time (e.g. MinGW DLLs on Windows) while continue to use default dynamic
linking at build time.

Also fix obsolete comments in confgure.ac - we do use different environment
for build and host now.
2014-01-18 19:50:54 +04:00