Callum Farmer
4cdcf2a37b
riscv64: fix image
...
- Make it actually work
- Split text/data/reloc/rodata sections
- Move hash sections to past end of image
(un-needed in PE)
- Correct section & file alignment
- Correct image size
Builds correctly but untested
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:08:24 -04:00
Callum Farmer
eadee98bf0
ARM32: fix image
...
- Make it actually work
- Split text/data/reloc/rodata sections
- Move hash sections to past end of image
(un-needed in PE)
- Correct section & file alignment
- Correct image size
- rename .reloc to .areloc within ELF
as only on ARM32 does this name cause
it to be marked as REL and subsequently
mistakenly added to RELSZ
Builds correctly & tested working in QEMU
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:56 -04:00
Callum Farmer
0bb329b0bf
Merge .plt into .text
...
ld writes .plt immediately after .text
which corrupts the alignment of .reloc
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:53 -04:00
Callum Farmer
262c1f4604
Split out rodata
...
rodata should be split for security
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:49 -04:00
Callum Farmer
136697dd49
.dynsym not required
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:44 -04:00
Callum Farmer
0209271936
Clean up size symbols
...
Tells ld to define them after their markers
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
9e47db1193
Add C++ extern C header markers
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
bbb501833d
X86_64: fix clang
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
db870d96d6
Mark _start as function
...
Currently marked as NOTYPE
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
18d53408ff
ARM32: _start must be global
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
2dcebec0ce
Add full Data Directories table
...
Microsoft dumpbin doesn't like the binary if
the full table doesn't exist
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
bfa3cead95
ARM32: fix L_DYNAMIC
...
L_DYNAMIC must be 32bits to be PCREL
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
f26e5a6eea
ctors.S: Fix section definitions
...
Using @ doesn't work on ARM32
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
dd82a45499
riscv: Use new ctors _entry func as entry point
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
6c142a6df4
riscv64 lds: fix ctors/dtors
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
a68997b11e
riscv: Avoid TEXTREL
...
Use expression instead of variable for _data_size
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:38 -04:00
Callum Farmer
6f0648992a
Avoid processor dependent sizes in assembly
...
.word -> .2byte
.short -> .2byte
.long -> .4byte
.quad -> .8byte
Reference: b83f0845b5
Fixes: https://sourceforge.net/p/gnu-efi/bugs/37/
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:05:31 -04:00
b'Nigel Croxon
20d8d8adc7
Merge /u/moodyhunter/gnu-efi/ branch master into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/52/
2023-05-18 14:14:54 +00:00
b'Nigel Croxon
9835e11ebe
Merge /u/gmbr3/gnu-efi/ branch ia32 into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/51/
2023-05-16 13:06:32 +00:00
Nigel Croxon
bbc2b528e0
Revert "Make ELF constructors/destructors work"
...
This reverts commit fe76d597a9
.
2023-05-16 09:05:00 -04:00
Nigel Croxon
fe76d597a9
Make ELF constructors/destructors work
...
Since commit [4f8b339fac
]
Simple EFI tools like for example t.c from the apps directory crash.
The reason seems to be a wrong null-pointer check in the
ctors()/dtors() functions in lib/entry.c.
sourceforge.net/u/davemueller
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2023-05-16 08:34:07 -04:00
Moody Liu
1de5094978
riscv64: adjust type definitions
...
CHAR8 needs to be defined while BOOLEAN should be removed
here to prevent typedef conflicts
Signed-off-by: Moody Liu <mooodyhunter@outlook.com>
2023-05-13 17:57:24 +01:00
Callum Farmer
99730f29b2
Structs with no linkage
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-11 15:12:36 +01:00
Callum Farmer
ba150f34d6
Add test for ctors & dtors with a priority
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
e1efa4d70a
No clean
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
7dac18443f
Re-write entry.c/ctors.S to work better
...
* Make entry.c work correctly in reverse order
* Remove incorrectly sized (on non-32bit) NULLs from ctors.S
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
4c6962457f
entry.c: fini_array is run backwards
...
fini_array is 65535 to 0 but stored 0 to 65535
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
9dbfe1c365
Align all ctors/dtors start to 16
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:19 +01:00
Callum Farmer
74b7b5e92c
entry.c: Fix null pointer exception
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:09 +01:00
Callum Farmer
9c5403e1e6
Copy marker names from binutils for init/fini
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 14:29:47 +01:00
Callum Farmer
b3cc412aad
entry.c: .ctors is run backwards
...
Store forwards, run backwards (65535 to 0)
Ref: 5a8e7e1332/ld/scripttempl/elf.sc (L310)
Ref: https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 14:29:47 +01:00
Callum Farmer
e2aa099738
lds: Support ctors/dtors with a priority
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 14:29:36 +01:00
Callum Farmer
4c938fac30
Merge ctors/dtors rela sections
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Callum Farmer
486b1c20c1
Enforce nocombreloc
...
It is needed to avoid ELF reloc (rela) issues and
to find un-merged reloc sections
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Callum Farmer
97499a0cf2
ctors.S: Use LSB defined section perms
...
Seems to not be correct at the moment, causes errors.
error: expected the entry size
.section .fini_array, "aM", @fini_array
Change per
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/specialsections.html
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Callum Farmer
9b1e06cd0c
Use -std instead of --std
...
--std isn't standardised. lol.
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Nigel Croxon
24c80efc1a
Bump revision to VERSION = 3.0.17
2023-05-02 07:51:45 -04:00
Callum Farmer
bf6fd0405d
ia32: No sdata section
...
There is no small data section on ia32,
this ends up being created as ld puts .got/.got.plt
here due to first declaration
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-21 13:38:17 +01:00
Callum Farmer
fd3d975161
ia32 GNUC: Use __asm__ instead of asm
...
Causes an error when using strict ISO modes as
then asm isn't defined
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-21 13:30:00 +01:00
Nigel Croxon
ebd55c4a66
Bump revision to VERSION = 3.0.16
2023-04-17 07:43:00 -04:00
b'Nigel Croxon
bc46fbdc84
Merge /u/gmbr3/gnu-efi/ branch TRUEFALSE into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/49/
2023-04-17 11:39:01 +00:00
b'Nigel Croxon
dcced03469
Merge /u/gmbr3/gnu-efi/ branch CHAR16 into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/48/
2023-04-17 11:38:41 +00:00
b'Nigel Croxon
d9275e2a70
Merge /u/gmbr3/gnu-efi/ branch unsigned-char into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/47/
2023-04-17 11:38:06 +00:00
b'Nigel Croxon
362ef3db04
Merge /u/gmbr3/gnu-efi/ branch nullptr into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/46/
2023-04-17 11:37:07 +00:00
b'Nigel Croxon
e0e1f53ce2
Merge /u/gmbr3/gnu-efi/ branch pkgconf2 into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/45/
2023-04-17 11:36:22 +00:00
b'Nigel Croxon
7219aba42c
Merge /u/yetist/gnu-efi/ branch dev-master into master
...
https://sourceforge.net/p/gnu-efi/code/merge-requests/33/
2023-04-17 11:35:08 +00:00
Callum Farmer
2a599ea133
Make TRUE/FALSE compatible with C23/C++
...
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-15 14:45:19 +01:00
Callum Farmer
056bdaa53e
Make VOID a typedef
...
'void' is a type so VOID can be typedef instead of
a '#define' to improve compiler output
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-13 14:32:37 +01:00
Callum Farmer
189200d0b0
Make WCHAR and CHAR16 identical
...
And actually use wchar_t
gnu-efi already uses L string literals which are of type
wchar_t
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-08 20:07:13 +01:00
Callum Farmer
e398748032
ISO-Latin-1 requires unsigned char
...
It has characters from 0 to 256 so this requires
an unsigned 8 bit value
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-08 19:16:26 +01:00