Move rodata into text so that jump tables work properly without -fno-jump-tables

This commit is contained in:
shinyquagsire23 2016-09-28 23:50:17 -06:00
parent e683b6c616
commit e0f2125068
4 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
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)
LDFLAGS := -nostdlib -nostartfiles

View File

@ -32,6 +32,9 @@ SECTIONS {
/* .text */
*(.text)
*(.text.*)
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
*(.glue_7)
*(.glue_7t)
*(.stub)
@ -52,12 +55,6 @@ SECTIONS {
/* Standard data sections */
. = ORIGIN(data);
.rodata ALIGN(256) : {
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
} : hdr_sdata
.rodata1 : { *(.rodata1) }
.data ALIGN(256) : {
*(.data)
*(.data.*)

View File

@ -1,5 +1,5 @@
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)
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 \

View File

@ -441,6 +441,9 @@ read(ElfFile &file, const std::string &filename)
} else if (addend >= DataAddress && addend < WiiuLoadAddress) {
relocation->symbol = findSymbol(file, DataAddress);
relocation->addend = addend - DataAddress;
} else if (addend >= CodeAddress && addend < DataAddress) {
relocation->symbol = findSymbol(file, CodeAddress);
relocation->addend = addend - CodeAddress;
} else {
// 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);