summaryrefslogtreecommitdiffstats
path: root/documentation/GNU-efi
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/GNU-efi')
-rw-r--r--documentation/GNU-efi77
1 files changed, 74 insertions, 3 deletions
diff --git a/documentation/GNU-efi b/documentation/GNU-efi
index 1efe81c..40cd91f 100644
--- a/documentation/GNU-efi
+++ b/documentation/GNU-efi
@@ -59,7 +59,18 @@ hello.so: $(OBJS)
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-$(ARCH) $^ $@
+-----
+Now expanded version in git
+Get ImageBase:
+ Run ./test.sh and then hello.efi...this prints ImageBase
+
+Get Offsets:
+ GDB
+ file hello.efi
+ -> get text and data offset
+ file
+ add-symbol-file hello.efi (ImageBase+text-off) -s .data (ImageBase+data-off)
#################################################################################
@@ -210,12 +221,72 @@ you need to add ImageBase address to their offsets:
* 3000 - ... is .text *
* c00 - ... is .data *
* (gdb) file || unload file *
-* add-symbol-table hello.efi (ImageBase+text-off) -s .data (ImageBase+data-off) *
+* add-symbol-file hello.efi (ImageBase+text-off) -s .data (ImageBase+data-off) *
*********************************************************************************
+#################################################################################
+# https://www.rodsbooks.com/efi-programming/hello.html #
+#################################################################################
-
-
+You should not normally include regular C header files, such as stdlib.h,
+because most of these header files define data types and functions that are used
+by the C library. This library is not available in EFI.
+
+************************************
+* efi.h and efilib.h always needed *
+************************************
+
+Entry point: efi_main() in GNU-efi
+
+CFLAGS:
+* -fno-stack-protector:
+ Stack protection isn't suppoerted by EFI, so there's no point in
+ building a binary with this feature active.
+
+* -fpic:
+ EFI requires that code be position-independet, hence the use
+ of this option.
+
+* -fshort-wchar:
+ GCC defines the wchar_t type to be 32 bits by default, but EFI requires
+ it to be 16 bits for 16-bit strings to work correctly.
+
+* fmno-red-zone:
+ On x86-64 systems, the red zone is an area that follows the stack pointer
+ that can be used for temporary variables. The EFI may modify this area,
+ though, so it's not safe to use, and you must compile EFI binaries with
+ this option.
+
+* -Wall:
+ When developing EFI applications, you might want to pay extra attention to
+ compiler warnings, and this switch (which causes warnings to be treated as
+ errors) can help.
+
+* -DEFI_FUNCTION_WRAPPER:
+ This option is required on the x86_64 platform, but is not defined on the
+ 32-bit x86 platform. It relates to th calling conventions for EFI functions,
+ described on the Using EFI Services page.
+
+LDFLAGS:
+* -nostdlib:
+ An EFI application should not be linked against standard libraries, and this
+ argument accomplishes this goal.
+
+* -nocombreloc:
+ This argument causes the linker to not combine relocation sections.
+
+* -T $(EFI_LDS):
+ To create an EFI binary, a non-standard linker script must be used, and this
+ option tells ld where to find it.
+
+* -shared:
+ Even with GNU-EFI's new linker script, ld can't create the final executable.
+ Instead, it creates a shared library, which is subsequently
+ turned into the final binary.
+
+* -Bsymbolic:
+ This option causes references to global symbols to be bound to the
+ definitions within the shared library.