mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-07 23:10:42 +01:00
Move rodata into text so that jump tables work properly without -fno-jump-tables
This commit is contained in:
parent
e683b6c616
commit
e0f2125068
@ -1,5 +1,5 @@
|
|||||||
LIBPATHS := -L$(WUT_ROOT)/lib
|
LIBPATHS := -L$(WUT_ROOT)/lib
|
||||||
CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding -fno-jump-tables -std=c11
|
CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding -std=c11
|
||||||
CXXFLAGS := $(CFLAGS)
|
CXXFLAGS := $(CFLAGS)
|
||||||
LDFLAGS := -nostdlib -nostartfiles
|
LDFLAGS := -nostdlib -nostartfiles
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ SECTIONS {
|
|||||||
/* .text */
|
/* .text */
|
||||||
*(.text)
|
*(.text)
|
||||||
*(.text.*)
|
*(.text.*)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
*(.rodata1)
|
||||||
*(.glue_7)
|
*(.glue_7)
|
||||||
*(.glue_7t)
|
*(.glue_7t)
|
||||||
*(.stub)
|
*(.stub)
|
||||||
@ -52,12 +55,6 @@ SECTIONS {
|
|||||||
/* Standard data sections */
|
/* Standard data sections */
|
||||||
. = ORIGIN(data);
|
. = ORIGIN(data);
|
||||||
|
|
||||||
.rodata ALIGN(256) : {
|
|
||||||
*(.rodata .rodata.*)
|
|
||||||
*(.gnu.linkonce.r.*)
|
|
||||||
} : hdr_sdata
|
|
||||||
.rodata1 : { *(.rodata1) }
|
|
||||||
|
|
||||||
.data ALIGN(256) : {
|
.data ALIGN(256) : {
|
||||||
*(.data)
|
*(.data)
|
||||||
*(.data.*)
|
*(.data.*)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
LIBPATHS := -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
|
LIBPATHS := -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
|
||||||
CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding -fno-jump-tables
|
CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding
|
||||||
CXXFLAGS := $(CFLAGS)
|
CXXFLAGS := $(CFLAGS)
|
||||||
LDFLAGS := -nostartfiles -T $(WUT_ROOT)/rules/rpl.ld -pie -fPIE -z common-page-size=64 -z max-page-size=64 -lcrt \
|
LDFLAGS := -nostartfiles -T $(WUT_ROOT)/rules/rpl.ld -pie -fPIE -z common-page-size=64 -z max-page-size=64 -lcrt \
|
||||||
-Wl,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size \
|
-Wl,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size \
|
||||||
|
@ -441,6 +441,9 @@ read(ElfFile &file, const std::string &filename)
|
|||||||
} else if (addend >= DataAddress && addend < WiiuLoadAddress) {
|
} else if (addend >= DataAddress && addend < WiiuLoadAddress) {
|
||||||
relocation->symbol = findSymbol(file, DataAddress);
|
relocation->symbol = findSymbol(file, DataAddress);
|
||||||
relocation->addend = addend - DataAddress;
|
relocation->addend = addend - DataAddress;
|
||||||
|
} else if (addend >= CodeAddress && addend < DataAddress) {
|
||||||
|
relocation->symbol = findSymbol(file, CodeAddress);
|
||||||
|
relocation->addend = addend - CodeAddress;
|
||||||
} else {
|
} else {
|
||||||
// If we can't find a proper symbol, write the addend in and hope for the best
|
// If we can't find a proper symbol, write the addend in and hope for the best
|
||||||
auto ptr = getLoaderDataPtr<uint32_t>(inSections, rela.offset);
|
auto ptr = getLoaderDataPtr<uint32_t>(inSections, rela.offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user