Browse Source

Merge /u/gmbr3/gnu-efi/ branch header into master

https://sourceforge.net/p/gnu-efi/code/merge-requests/64/
b'Nigel Croxon 1 year ago
parent
commit
8c9ad45504

+ 2 - 2
gnuefi/elf_aarch64_efi.lds

@@ -22,12 +22,12 @@ SECTIONS
   }
   _etext = .;
   _text_size = _etext - _text;
-  . = ALIGN(4096);
+  . = ALIGN(65536);
   .reloc :
   {
     KEEP (*(.reloc))
   }
-  . = ALIGN(65536);
+  . = ALIGN(4096);
   .dynamic  : { *(.dynamic) }
   . = ALIGN(4096);
   .data :

+ 1 - 1
gnuefi/elf_arm_efi.lds

@@ -27,7 +27,7 @@ SECTIONS
   } =0
   _reloc_vsize = _evreloc - _reloc;
   _reloc_size = _ereloc - _reloc;
-  . = ALIGN(65536);
+  . = ALIGN(4096);
   _data = .;
   .dynamic  : { *(.dynamic) }
   . = ALIGN(4096);

+ 1 - 1
inc/aarch64/efisetjmp_arch.h

@@ -29,6 +29,6 @@ typedef struct {
 	UINT64	D13;
 	UINT64	D14;
 	UINT64	D15;
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_AARCH64_SETJMP_H */

+ 1 - 1
inc/arm/efisetjmp_arch.h

@@ -16,6 +16,6 @@ typedef struct {
 	UINT32 R12;
 	UINT32 R13;
 	UINT32 R14;
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_ARM_SETJMP_H */

+ 12 - 2
inc/eficompiler.h

@@ -39,9 +39,19 @@ Abstract:
 #endif
 
 #ifdef _MSC_EXTENSIONS
-#define ALIGN(x) __declspec(align(x))
+#define EFI_ALIGN(x) __declspec(align(x))
 #else
-#define ALIGN(x) __attribute__((__aligned__(x)))
+#define EFI_ALIGN(x) __attribute__((__aligned__(x)))
+#endif
+
+#ifndef ALIGN
+#define ALIGN(x) EFI_ALIGN(x)
+#endif
+
+#ifdef _MSC_EXTENSIONS
+#define EFI_NORETURN __declspec(noreturn)
+#else
+#define EFI_NORETURN __attribute__((noreturn))
 #endif
 
 /* Also add a catch-all on __attribute__() for MS compilers */

+ 1 - 1
inc/efisetjmp.h

@@ -5,6 +5,6 @@
 #include "efisetjmp_arch.h"
 
 extern UINTN setjmp(jmp_buf env) __attribute__((returns_twice));
-extern VOID longjmp(jmp_buf env, UINTN value) __attribute__((noreturn));
+extern VOID longjmp(jmp_buf env, UINTN value) EFI_NORETURN;
 
 #endif /* GNU_EFI_SETJMP_H */

+ 1 - 1
inc/ia32/efisetjmp_arch.h

@@ -10,6 +10,6 @@ typedef struct {
 	UINT32	Ebp;
 	UINT32	Esp;
 	UINT32	Eip;
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_IA32_SETJMP_H */

+ 1 - 1
inc/ia64/efisetjmp_arch.h

@@ -42,6 +42,6 @@ typedef struct {
 	UINT64	Predicates;
 	UINT64	LoopCount;
 	UINT64	FPSR;
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_IA64_SETJMP_H */

+ 1 - 1
inc/loongarch64/efisetjmp_arch.h

@@ -18,6 +18,6 @@ typedef struct {
 	UINT64	S6;
 	UINT64	S7;
 	UINT64	S8;
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_LOONGARCH64_SETJMP_H */

+ 1 - 1
inc/mips64el/efisetjmp_arch.h

@@ -29,6 +29,6 @@ typedef struct {
 	UINT64	F30;
 	UINT64	F31;
 #endif
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_MIPS64EL_SETJMP_H */

+ 1 - 1
inc/riscv64/efisetjmp_arch.h

@@ -35,6 +35,6 @@ typedef struct {
 	UINT64	fs9;
 	UINT64	fs10;
 	UINT64	fs11;
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_RISCV64_SETJMP_H */

+ 1 - 1
inc/x86_64/efisetjmp_arch.h

@@ -17,6 +17,6 @@ typedef struct {
 	UINT64	Rip;
 	UINT64	MxCsr;
 	UINT8	XmmBuffer[160]; // XMM6 - XMM15
-} ALIGN(JMPBUF_ALIGN) jmp_buf[1];
+} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1];
 
 #endif /* GNU_EFI_X86_64_SETJMP_H */

+ 4 - 9
lib/ctors.S

@@ -9,34 +9,29 @@
  * have NULLs which aren't guaranteed to be at the end.
  */
 	.section .init_array,"aw",%init_array
-	.p2align 3, 0
+	.p2align 4, 0
 	.globl __init_array_start
 __init_array_start:
-	.p2align 3, 0
 	.globl __init_array_end
 __init_array_end:
 	.section .ctors,"aw",%progbits
-	.p2align 3, 0
+	.p2align 4, 0
 	.globl __CTOR_LIST__
 __CTOR_LIST__:
-	.p2align 3, 0
 	.globl __CTOR_END__
 __CTOR_END__:
 	.section .dtors,"aw",%progbits
-	.p2align 3, 0
+	.p2align 4, 0
 	.globl __DTOR_LIST__
 __DTOR_LIST__:
-	.p2align 3, 0
 	.globl __DTOR_END__
 __DTOR_END__:
 	.section .fini_array,"aw",%fini_array
-	.p2align 3, 0
+	.p2align 4, 0
 	.globl __fini_array_start
 __fini_array_start:
-	.p2align 3, 0
 	.globl __fini_array_end
 __fini_array_end:
-	.p2align 3, 0
 
 #if defined(__ELF__) && defined(__linux__)
 	.section .note.GNU-stack,"",%progbits