summaryrefslogtreecommitdiffstats
path: root/gnu-efi-3.0/Make.defaults
diff options
context:
space:
mode:
authornoxorc <nigel.croxon@hp.com>2013-05-15 15:26:16 -0400
committernoxorc <nigel.croxon@hp.com>2013-05-15 15:26:16 -0400
commit0ca0dacb59d71d9078604df290ea285f460b61fc (patch)
tree678e8e5bcde7c2cfe0ae865416ec31cd2b47a44c /gnu-efi-3.0/Make.defaults
parent8e252676151ba6d0b5ed62af8bc654702cab33bb (diff)
downloadgnu-efi-3.0-0ca0dacb59d71d9078604df290ea285f460b61fc.tar.gz
gnu-efi-3.0-0ca0dacb59d71d9078604df290ea285f460b61fc.tar.xz
gnu-efi-3.0-0ca0dacb59d71d9078604df290ea285f460b61fc.zip
- Removes the ElfW() macro usage from reloc_ia32.c and reloc_x86_64.c. These
macros only exist in link.h on Linux. On FreeBSD, the equivalent macro is __ElfN(). But the macro usage is redundant. You're only going to compile the ia32 file for IA32 binaries and the x86_64 file for X64 binaries. If you had just one file built for both cases, then using the macro might make more sense. - Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and reloc_x86_64.c. - Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined as: typedef int __attribute__((__mode__(__DI__))) int64_t; typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t; This removes the conflict between the host types dragged in by elf.h and the type definitions in efibind.h that made the #define foo_t efi_foo_t" hack necessary. Also, int8_t is now defined as signed char instead of just char (assuming char == signed char is apparently not good enough). - Also modifies these files to use stdint.h instead of stdint-gcc.h. It's unclear if this is completely correct, but stdint-gcc.h is not present with all GCC installs, and if you use -std=c99 or later you will force this case to be hit. This also can break clang, which doesn't have a stdint-gcc.h at all. - Removes the #include of <link.h> from reloc_ia32.c and reloc_x86_64.c (since with the previous changes it's not needed anymore). - Places the #include of <elf.h> after #include <efi>/#include <efilib.h> so that we know the types will always be defined properly, in case you build on a system where <elf.h> doesn't automatically pull in the right header files to define all the needed types. (This actually happens on VxWorks. It's harmless elsewhere. If you don't care about VxWorks, you can leave this out.) - Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to @function. The clang compiler doesn't like the former. Clang and GCC both like the latter. - Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former rather than the latter, which breaks the build. This may also be the case on some other OSes. There's a way to force uname(1) to return x86_64 as the machine type, but this way is a little friendlier. - Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just FreeBSD/amd64. - Modifies apps/Makefile to always use $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or 64-bit FreeBSD instead of just for the x86_64 case. - Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause linking to fail if there are any unsatisfied symbols when creating foo.so during any of the app builds, as opposed to just silently succeeding and producing an unusable binary. - Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack- check. This prevents clang from inserting a call to memset() when compiling the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards against the native compiler in some Linux distros from adding in stack checking code which relies on libc help that isn't present in the EFI runtime environment. This does the following: - Cleans up the ia32 and x86-64 relocation code a bit (tries to break the dependency between the host ELF headers and the EFI runtime environment) - Avoids the dependency on stdint-gcc.h which may not always be available - Allows GNU EFI to build out of the box on both FreeBSD/i386 and FreeBSD/amd64 - Allows GNU EFI to build out of the box with either GCC or clang on FreeBSD/i386 and FreeBSD/amd64 9.0 and later. - Makes things a little easier to port to VxWorks - Avoids creating un-runable binaries with unresolved symbol definitions (which can be very confusing to debug)
Diffstat (limited to 'gnu-efi-3.0/Make.defaults')
-rw-r--r--gnu-efi-3.0/Make.defaults8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu-efi-3.0/Make.defaults b/gnu-efi-3.0/Make.defaults
index 38da180..0585915 100644
--- a/gnu-efi-3.0/Make.defaults
+++ b/gnu-efi-3.0/Make.defaults
@@ -46,6 +46,10 @@ TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
ARCH := $(shell uname -m | sed s,i[3456789]86,ia32,)
+# FreeBSD (and possibly others) reports amd64 instead of x86_64
+ifeq ($(ARCH), amd64)
+ARCH = x86_64
+endif
OS = $(shell uname -s)
INCDIR = -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) -I$(TOPDIR)/inc/protocol
GCCVERSION := $(shell gcc -dumpversion | cut -f1 -d.)
@@ -56,9 +60,9 @@ CPPFLAGS = -DCONFIG_$(ARCH)
ifeq ($(GCCNEWENOUGH),1)
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
endif
-CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants
+CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -ffreestanding -fno-stack-protector -fno-stack-check
ASFLAGS = $(ARCH3264)
-LDFLAGS = -nostdlib
+LDFLAGS = -nostdlib --no-undefined
INSTALL = install
prefix = /usr/bin/