summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorb'Nigel Croxon <allura@localhost>2023-05-16 13:06:32 +0000
committerb'Nigel Croxon <allura@localhost>2023-05-16 13:06:32 +0000
commit9835e11ebe95ed8372ac2a6671de07cc970cdee0 (patch)
treef2f1d166ba12123605c3dc3e12790e9391d2a31c /apps
parentbbc2b528e08e5b99e08e103302ee90046135a039 (diff)
parent99730f29b2f8874bc7bfad383ea8eb52679e8897 (diff)
downloadgnu-efi-master.tar.gz
Merge /u/gmbr3/gnu-efi/ branch ia32 into masterHEADmaster
https://sourceforge.net/p/gnu-efi/code/merge-requests/51/
Diffstat (limited to 'apps')
-rw-r--r--apps/Makefile2
-rw-r--r--apps/ctors_dtors_priority_test.c29
2 files changed, 30 insertions, 1 deletions
diff --git a/apps/Makefile b/apps/Makefile
index 6ebd438..424ee9d 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -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 \
FreePages.efi setjmp.efi debughook.efi debughook.efi.debug \
bltgrid.efi lfbgrid.efi setdbg.efi unsetdbg.efi \
- ctors_test.efi
+ ctors_test.efi ctors_dtors_priority_test.efi
TARGET_BSDRIVERS = drv0.efi
TARGET_RTDRIVERS =
diff --git a/apps/ctors_dtors_priority_test.c b/apps/ctors_dtors_priority_test.c
new file mode 100644
index 0000000..0458c08
--- /dev/null
+++ b/apps/ctors_dtors_priority_test.c
@@ -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;
+} \ No newline at end of file