Merge /u/gmbr3/gnu-efi/ branch ia32 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/51/
This commit is contained in:
commit
9835e11ebe
@ -125,9 +125,9 @@ ifeq ($(ARCH),x86_64)
|
|||||||
&& [ $(GCCMINOR) -ge "7" ] ) ) \
|
&& [ $(GCCMINOR) -ge "7" ] ) ) \
|
||||||
&& echo 1)
|
&& echo 1)
|
||||||
ifeq ($(GCCNEWENOUGH),1)
|
ifeq ($(GCCNEWENOUGH),1)
|
||||||
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
|
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args -std=c11
|
||||||
else ifeq ($(USING_CLANG),clang)
|
else ifeq ($(USING_CLANG),clang)
|
||||||
CPPFLAGS += -DGNU_EFI_USE_MS_ABI --std=c11
|
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -std=c11
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -mno-red-zone
|
CFLAGS += -mno-red-zone
|
||||||
@ -197,7 +197,7 @@ endif
|
|||||||
ARFLAGS := rDv
|
ARFLAGS := rDv
|
||||||
ASFLAGS += $(ARCH3264)
|
ASFLAGS += $(ARCH3264)
|
||||||
LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \
|
LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \
|
||||||
--build-id=sha1
|
--build-id=sha1 -z nocombreloc
|
||||||
|
|
||||||
ifneq ($(ARCH),arm)
|
ifneq ($(ARCH),arm)
|
||||||
export LIBGCC=$(shell $(CC) $(CFLAGS) $(ARCH3264) -print-libgcc-file-name)
|
export LIBGCC=$(shell $(CC) $(CFLAGS) $(ARCH3264) -print-libgcc-file-name)
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
# SUCH DAMAGE.
|
# SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
.SECONDARY:
|
||||||
|
|
||||||
%.efi: %.so
|
%.efi: %.so
|
||||||
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
|
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
|
||||||
-j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
|
-j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
|
||||||
|
@ -64,7 +64,7 @@ TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi \
|
|||||||
route80h.efi drv0_use.efi AllocPages.efi exit.efi \
|
route80h.efi drv0_use.efi AllocPages.efi exit.efi \
|
||||||
FreePages.efi setjmp.efi debughook.efi debughook.efi.debug \
|
FreePages.efi setjmp.efi debughook.efi debughook.efi.debug \
|
||||||
bltgrid.efi lfbgrid.efi setdbg.efi unsetdbg.efi \
|
bltgrid.efi lfbgrid.efi setdbg.efi unsetdbg.efi \
|
||||||
ctors_test.efi
|
ctors_test.efi ctors_dtors_priority_test.efi
|
||||||
TARGET_BSDRIVERS = drv0.efi
|
TARGET_BSDRIVERS = drv0.efi
|
||||||
TARGET_RTDRIVERS =
|
TARGET_RTDRIVERS =
|
||||||
|
|
||||||
|
29
apps/ctors_dtors_priority_test.c
Normal file
29
apps/ctors_dtors_priority_test.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <efi.h>
|
||||||
|
#include <efilib.h>
|
||||||
|
|
||||||
|
// 101 in init_array, 65434 in ctors
|
||||||
|
static void __attribute__((constructor(101))) ctors101() {
|
||||||
|
Print(L"1) ctor with lower numbered priority \r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 65434 in init_array, 101 in ctors
|
||||||
|
static void __attribute__((constructor(65434))) ctors65434() {
|
||||||
|
Print(L"2) ctor with higher numbered priority \r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 101 in fini_array, 65434 in dtors
|
||||||
|
static void __attribute__((destructor(101))) dtors101() {
|
||||||
|
Print(L"4) dtor with lower numbered priority \r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 65434 in fini_array, 101 in dtors
|
||||||
|
static void __attribute__((destructor(65434))) dtors65434() {
|
||||||
|
Print(L"3) dtor with higher numbered priority \r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
efi_main (EFI_HANDLE image EFI_UNUSED, EFI_SYSTEM_TABLE *systab EFI_UNUSED)
|
||||||
|
{
|
||||||
|
Print(L"Main function \r\n");
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
@ -48,18 +48,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -84,6 +91,11 @@ SECTIONS
|
|||||||
*(.rela.got)
|
*(.rela.got)
|
||||||
*(.rela.dyn)
|
*(.rela.dyn)
|
||||||
*(.rela.stab)
|
*(.rela.stab)
|
||||||
|
*(.rela.init_array*)
|
||||||
|
*(.rela.fini_array*)
|
||||||
|
*(.rela.ctors*)
|
||||||
|
*(.rela.dtors*)
|
||||||
|
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.rela.plt : { *(.rela.plt) }
|
.rela.plt : { *(.rela.plt) }
|
||||||
|
@ -35,18 +35,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -70,6 +77,11 @@ SECTIONS
|
|||||||
*(.rel.got)
|
*(.rel.got)
|
||||||
*(.rel.dyn)
|
*(.rel.dyn)
|
||||||
*(.rel.stab)
|
*(.rel.stab)
|
||||||
|
*(.rel.init_array*)
|
||||||
|
*(.rel.fini_array*)
|
||||||
|
*(.rel.ctors*)
|
||||||
|
*(.rel.dtors*)
|
||||||
|
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.rel.plt : { *(.rel.plt) }
|
.rel.plt : { *(.rel.plt) }
|
||||||
|
@ -39,18 +39,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -70,6 +77,10 @@ SECTIONS
|
|||||||
*(.rel.got)
|
*(.rel.got)
|
||||||
*(.rel.dyn)
|
*(.rel.dyn)
|
||||||
*(.rel.stab)
|
*(.rel.stab)
|
||||||
|
*(.rel.init_array*)
|
||||||
|
*(.rel.fini_array*)
|
||||||
|
*(.rel.ctors*)
|
||||||
|
*(.rel.dtors*)
|
||||||
*(.data.rel.ro.local)
|
*(.data.rel.ro.local)
|
||||||
*(.data.rel.local)
|
*(.data.rel.local)
|
||||||
*(.data.rel.ro)
|
*(.data.rel.ro)
|
||||||
|
@ -48,18 +48,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -80,6 +87,10 @@ SECTIONS
|
|||||||
*(.rel.data.*)
|
*(.rel.data.*)
|
||||||
*(.rel.got)
|
*(.rel.got)
|
||||||
*(.rel.stab)
|
*(.rel.stab)
|
||||||
|
*(.rel.init_array*)
|
||||||
|
*(.rel.fini_array*)
|
||||||
|
*(.rel.ctors*)
|
||||||
|
*(.rel.dtors*)
|
||||||
*(.data.rel.ro.local)
|
*(.data.rel.ro.local)
|
||||||
*(.data.rel.local)
|
*(.data.rel.local)
|
||||||
*(.data.rel.ro)
|
*(.data.rel.ro)
|
||||||
|
@ -49,18 +49,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -82,7 +89,10 @@ SECTIONS
|
|||||||
*(.rela.dyn)
|
*(.rela.dyn)
|
||||||
*(.rela.gnu.linkonce.d*)
|
*(.rela.gnu.linkonce.d*)
|
||||||
*(.rela.stab)
|
*(.rela.stab)
|
||||||
*(.rela.ctors)
|
*(.rela.init_array*)
|
||||||
|
*(.rela.fini_array*)
|
||||||
|
*(.rela.ctors*)
|
||||||
|
*(.rela.dtors*)
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.rela.plt : { *(.rela.plt) }
|
.rela.plt : { *(.rela.plt) }
|
||||||
|
@ -36,18 +36,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -70,6 +77,10 @@ SECTIONS
|
|||||||
*(.rel.got)
|
*(.rel.got)
|
||||||
*(.rel.dyn)
|
*(.rel.dyn)
|
||||||
*(.rel.stab)
|
*(.rel.stab)
|
||||||
|
*(.rel.init_array*)
|
||||||
|
*(.rel.fini_array*)
|
||||||
|
*(.rel.ctors*)
|
||||||
|
*(.rel.dtors*)
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.rel.plt : { *(.rel.plt) }
|
.rel.plt : { *(.rel.plt) }
|
||||||
|
@ -52,6 +52,10 @@ SECTIONS {
|
|||||||
*(.rela.got)
|
*(.rela.got)
|
||||||
*(.rela.dyn)
|
*(.rela.dyn)
|
||||||
*(.rela.stab)
|
*(.rela.stab)
|
||||||
|
*(.rela.init_array)
|
||||||
|
*(.rela.fini_array)
|
||||||
|
*(.rela.ctors)
|
||||||
|
*(.rela.dtors)
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.rela.plt : { *(.rela.plt) }
|
.rela.plt : { *(.rela.plt) }
|
||||||
|
@ -46,18 +46,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -82,6 +89,10 @@ SECTIONS
|
|||||||
*(.rela.got)
|
*(.rela.got)
|
||||||
*(.rela.dyn)
|
*(.rela.dyn)
|
||||||
*(.rela.stab)
|
*(.rela.stab)
|
||||||
|
*(.rela.init_array*)
|
||||||
|
*(.rela.fini_array*)
|
||||||
|
*(.rela.ctors*)
|
||||||
|
*(.rela.dtors*)
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.rela.plt : { *(.rela.plt) }
|
.rela.plt : { *(.rela.plt) }
|
||||||
|
@ -44,18 +44,25 @@ SECTIONS
|
|||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_init_array = .;
|
__init_array_start = .;
|
||||||
*(SORT_BY_NAME(.init_array))
|
*(SORT(.init_array.*))
|
||||||
_init_array_end = .;
|
*(.init_array)
|
||||||
|
__init_array_end = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__CTOR_LIST__ = .;
|
__CTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.ctors))
|
*(SORT(.ctors.*))
|
||||||
|
*(.ctors)
|
||||||
__CTOR_END__ = .;
|
__CTOR_END__ = .;
|
||||||
|
. = ALIGN(16);
|
||||||
__DTOR_LIST__ = .;
|
__DTOR_LIST__ = .;
|
||||||
*(SORT_BY_NAME(.dtors))
|
*(SORT(.dtors.*))
|
||||||
|
*(.dtors)
|
||||||
__DTOR_END__ = .;
|
__DTOR_END__ = .;
|
||||||
_fini_array = .;
|
. = ALIGN(16);
|
||||||
*(SORT_BY_NAME(.fini_array))
|
__fini_array_start = .;
|
||||||
_fini_array_end = .;
|
*(SORT(.fini_array.*))
|
||||||
|
*(.fini_array)
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||||
it all into .data: */
|
it all into .data: */
|
||||||
@ -76,6 +83,10 @@ SECTIONS
|
|||||||
*(.rela.data*)
|
*(.rela.data*)
|
||||||
*(.rela.got)
|
*(.rela.got)
|
||||||
*(.rela.stab)
|
*(.rela.stab)
|
||||||
|
*(.rela.init_array*)
|
||||||
|
*(.rela.fini_array*)
|
||||||
|
*(.rela.ctors*)
|
||||||
|
*(.rela.dtors*)
|
||||||
}
|
}
|
||||||
_edata = .;
|
_edata = .;
|
||||||
_data_size = . - _etext;
|
_data_size = . - _etext;
|
||||||
|
29
lib/ctors.S
29
lib/ctors.S
@ -8,38 +8,35 @@
|
|||||||
* end/END definitions, and the fact that they're mergeable, they can also
|
* end/END definitions, and the fact that they're mergeable, they can also
|
||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
.section .init_array, "aM", @init_array
|
.section .init_array, "aw", @init_array
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl _init_array
|
.globl __init_array_start
|
||||||
_init_array:
|
__init_array_start:
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl _init_array_end
|
.globl __init_array_end
|
||||||
_init_array_end:
|
__init_array_end:
|
||||||
.long 0
|
.section .ctors, "aw", @progbits
|
||||||
.section .ctors, "aM", @init_array
|
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl __CTOR_LIST__
|
.globl __CTOR_LIST__
|
||||||
__CTOR_LIST__:
|
__CTOR_LIST__:
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl __CTOR_END__
|
.globl __CTOR_END__
|
||||||
__CTOR_END__:
|
__CTOR_END__:
|
||||||
.long 0
|
.section .dtors, "aw", @progbits
|
||||||
.section .dtors, "aM", @fini_array
|
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl __DTOR_LIST__
|
.globl __DTOR_LIST__
|
||||||
__DTOR_LIST__:
|
__DTOR_LIST__:
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl __DTOR_END__
|
.globl __DTOR_END__
|
||||||
__DTOR_END__:
|
__DTOR_END__:
|
||||||
.long 0
|
.section .fini_array, "aw", @fini_array
|
||||||
.section .fini_array, "aM", @fini_array
|
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl _fini_array
|
.globl __fini_array_start
|
||||||
_fini_array:
|
__fini_array_start:
|
||||||
|
.p2align 3, 0
|
||||||
|
.globl __fini_array_end
|
||||||
|
__fini_array_end:
|
||||||
.p2align 3, 0
|
.p2align 3, 0
|
||||||
.globl _fini_array_end
|
|
||||||
_fini_array_end:
|
|
||||||
.long 0
|
|
||||||
|
|
||||||
#if defined(__ELF__) && defined(__linux__)
|
#if defined(__ELF__) && defined(__linux__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
@ -1083,11 +1083,12 @@ _DevPathNodeUnknown (
|
|||||||
* Entries hold "Type" and "SubType" for know values.
|
* Entries hold "Type" and "SubType" for know values.
|
||||||
* Special "SubType" 0 is used as default for known type with unknown subtype.
|
* Special "SubType" 0 is used as default for known type with unknown subtype.
|
||||||
*/
|
*/
|
||||||
struct {
|
typedef struct {
|
||||||
UINT8 Type;
|
UINT8 Type;
|
||||||
UINT8 SubType;
|
UINT8 SubType;
|
||||||
VOID (*Function)(POOL_PRINT *, VOID *);
|
VOID (*Function)(POOL_PRINT *, VOID *);
|
||||||
} DevPathTable[] = {
|
} DevPathTable_Type;
|
||||||
|
DevPathTable_Type DevPathTable[] = {
|
||||||
{ HARDWARE_DEVICE_PATH, HW_PCI_DP, _DevPathPci},
|
{ HARDWARE_DEVICE_PATH, HW_PCI_DP, _DevPathPci},
|
||||||
{ HARDWARE_DEVICE_PATH, HW_PCCARD_DP, _DevPathPccard},
|
{ HARDWARE_DEVICE_PATH, HW_PCCARD_DP, _DevPathPccard},
|
||||||
{ HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, _DevPathMemMap},
|
{ HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, _DevPathMemMap},
|
||||||
|
42
lib/entry.c
42
lib/entry.c
@ -7,45 +7,51 @@
|
|||||||
#include <efi.h>
|
#include <efi.h>
|
||||||
#include <efilib.h>
|
#include <efilib.h>
|
||||||
|
|
||||||
|
typedef void (*funcp)(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that these aren't the using the GNU "CONSTRUCTOR" output section
|
* Note that these aren't the using the GNU "CONSTRUCTOR" output section
|
||||||
* command, so they don't start with a size. Because of p2align and the
|
* command, so they don't start with a size. Because of p2align and the
|
||||||
* end/END definitions, and the fact that they're mergeable, they can also
|
* end/END definitions, and the fact that they're mergeable, they can also
|
||||||
* have NULLs which aren't guaranteed to be at the end.
|
* have NULLs which aren't guaranteed to be at the end.
|
||||||
*/
|
*/
|
||||||
extern UINTN _init_array, _init_array_end;
|
extern funcp __init_array_start[], __init_array_end[];
|
||||||
extern UINTN __CTOR_LIST__, __CTOR_END__;
|
extern funcp __CTOR_LIST__[], __CTOR_END__[];
|
||||||
extern UINTN _fini_array, _fini_array_end;
|
extern funcp __fini_array_start[], __fini_array_end[];
|
||||||
extern UINTN __DTOR_LIST__, __DTOR_END__;
|
extern funcp __DTOR_LIST__[], __DTOR_END__[];
|
||||||
|
|
||||||
typedef void (*funcp)(void);
|
|
||||||
|
|
||||||
static void ctors(void)
|
static void ctors(void)
|
||||||
{
|
{
|
||||||
for (funcp *location = (void *)&_init_array; location < (funcp *)&_init_array_end; location++) {
|
size_t __init_array_length = __init_array_end - __init_array_start;
|
||||||
funcp func = *location;
|
for (size_t i = 0; i < __init_array_length; i++) {
|
||||||
if (location != NULL)
|
funcp func = __init_array_start[i];
|
||||||
|
if (func != NULL)
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (funcp *location = (void *)&__CTOR_LIST__; location < (funcp *)&__CTOR_END__; location++) {
|
size_t __CTOR_length = __CTOR_END__ - __CTOR_LIST__;
|
||||||
funcp func = *location;
|
for (size_t i = 0; i < __CTOR_length; i++) {
|
||||||
if (location != NULL)
|
size_t current = __CTOR_length - i - 1;
|
||||||
|
funcp func = __CTOR_LIST__[current];
|
||||||
|
if (func != NULL)
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dtors(void)
|
static void dtors(void)
|
||||||
{
|
{
|
||||||
for (funcp *location = (void *)&__DTOR_LIST__; location < (funcp *)&__DTOR_END__; location++) {
|
size_t __DTOR_length = __DTOR_END__ - __DTOR_LIST__;
|
||||||
funcp func = *location;
|
for (size_t i = 0; i < __DTOR_length; i++) {
|
||||||
if (location != NULL)
|
funcp func = __DTOR_LIST__[i];
|
||||||
|
if (func != NULL)
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (funcp *location = (void *)&_fini_array; location < (funcp *)&_fini_array_end; location++) {
|
size_t __fini_array_length = __fini_array_end - __fini_array_start;
|
||||||
funcp func = *location;
|
for (size_t i = 0; i < __fini_array_length; i++) {
|
||||||
if (location != NULL)
|
size_t current = __fini_array_length - i - 1;
|
||||||
|
funcp func = __fini_array_start[current];
|
||||||
|
if (func != NULL)
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,11 @@ Revision History
|
|||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
|
|
||||||
|
|
||||||
struct {
|
typedef struct {
|
||||||
EFI_STATUS Code;
|
EFI_STATUS Code;
|
||||||
WCHAR *Desc;
|
WCHAR *Desc;
|
||||||
} ErrorCodeTable[] = {
|
} ErrorCodeTable_Type;
|
||||||
|
ErrorCodeTable_Type ErrorCodeTable[] = {
|
||||||
{ EFI_SUCCESS, L"Success"},
|
{ EFI_SUCCESS, L"Success"},
|
||||||
{ EFI_LOAD_ERROR, L"Load Error"},
|
{ EFI_LOAD_ERROR, L"Load Error"},
|
||||||
{ EFI_INVALID_PARAMETER, L"Invalid Parameter"},
|
{ EFI_INVALID_PARAMETER, L"Invalid Parameter"},
|
||||||
|
Loading…
Reference in New Issue
Block a user