mirror of https://github.com/zeldaret/oot.git
Revert linker padding strategy back to pad_text spec directives
This commit is contained in:
parent
c4b38b98bc
commit
d04725480d
4
Makefile
4
Makefile
|
|
@ -1031,10 +1031,6 @@ $(BUILD_DIR)/assets/%.bin.inc.c: $(EXTRACTED_DIR)/assets/%.bin
|
|||
$(BUILD_DIR)/assets/%.jpg.inc.c: $(EXTRACTED_DIR)/assets/%.jpg
|
||||
$(N64TEXCONV) JFIF "" $< $@
|
||||
|
||||
# .text unaccounted linker padding
|
||||
$(BUILD_DIR)/__pad_text%.o:
|
||||
echo ".text; .fill 0x10" | $(AS) $(ASFLAGS) -o $@
|
||||
|
||||
# Audio
|
||||
|
||||
AUDIO_BUILD_DEBUG ?= 0
|
||||
|
|
|
|||
10
spec/spec
10
spec/spec
|
|
@ -664,7 +664,7 @@ beginseg
|
|||
|
||||
// audio
|
||||
#if OOT_VERSION < NTSC_1_1 || !PLATFORM_N64
|
||||
include "$(BUILD_DIR)/__pad_text0.o"
|
||||
pad_text
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/audio/internal/data.o"
|
||||
include "$(BUILD_DIR)/src/audio/internal/synthesis.o"
|
||||
|
|
@ -673,16 +673,16 @@ beginseg
|
|||
include "$(BUILD_DIR)/src/audio/internal/thread.o"
|
||||
include "$(BUILD_DIR)/src/audio/internal/os.o"
|
||||
#if OOT_PAL_N64
|
||||
include "$(BUILD_DIR)/__pad_text1.o"
|
||||
include "$(BUILD_DIR)/__pad_text2.o"
|
||||
include "$(BUILD_DIR)/__pad_text3.o"
|
||||
pad_text
|
||||
pad_text
|
||||
pad_text
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/audio/internal/playback.o"
|
||||
include "$(BUILD_DIR)/src/audio/internal/effects.o"
|
||||
include "$(BUILD_DIR)/src/audio/internal/seqplayer.o"
|
||||
include "$(BUILD_DIR)/src/audio/game/general.o"
|
||||
#if !PLATFORM_N64 && !DEBUG_FEATURES
|
||||
include "$(BUILD_DIR)/__pad_text4.o"
|
||||
pad_text
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/audio/game/sfx_params.o"
|
||||
include "$(BUILD_DIR)/src/audio/game/sfx.o"
|
||||
|
|
|
|||
|
|
@ -9,12 +9,15 @@
|
|||
struct Segment* g_segments;
|
||||
int g_segmentsCount;
|
||||
|
||||
static void write_progbits_section(FILE *fout, struct Segment *seg, const char *section_name)
|
||||
static void write_progbits_section(FILE *fout, struct Segment *seg, const char *section_name, bool with_padding)
|
||||
{
|
||||
fprintf(fout, " .%s :\n {\n", section_name);
|
||||
|
||||
for (int i = 0; i < seg->includesCount; i++)
|
||||
for (int i = 0; i < seg->includesCount; i++) {
|
||||
fprintf(fout, " %s(.%s*)\n", seg->includes[i].fpath, section_name);
|
||||
if (with_padding && seg->includes[i].linkerPadding != 0)
|
||||
fprintf(fout, " . += 0x%X;\n", seg->includes[i].linkerPadding);
|
||||
}
|
||||
|
||||
fprintf(fout, " }\n");
|
||||
}
|
||||
|
|
@ -43,9 +46,9 @@ static void write_linker_script(FILE *fout, struct Segment *seg)
|
|||
"SECTIONS {\n"
|
||||
);
|
||||
|
||||
write_progbits_section(fout, seg, "text");
|
||||
write_progbits_section(fout, seg, "data");
|
||||
write_progbits_section(fout, seg, "rodata");
|
||||
write_progbits_section(fout, seg, "text", true);
|
||||
write_progbits_section(fout, seg, "data", false);
|
||||
write_progbits_section(fout, seg, "rodata", false);
|
||||
write_noload_section(fout, seg, "bss");
|
||||
|
||||
/* GNU ld assumes that the linker script always combines .gptab.data and
|
||||
|
|
|
|||
10
tools/spec.c
10
tools/spec.c
|
|
@ -143,6 +143,7 @@ static const char *const stmtNames[] =
|
|||
[STMT_romalign] = "romalign",
|
||||
[STMT_stack] = "stack",
|
||||
[STMT_increment] = "increment",
|
||||
[STMT_pad_text] = "pad_text",
|
||||
};
|
||||
|
||||
STMTId get_stmt_id_by_stmt_name(const char *stmtName, int lineNum) {
|
||||
|
|
@ -157,8 +158,8 @@ STMTId get_stmt_id_by_stmt_name(const char *stmtName, int lineNum) {
|
|||
}
|
||||
|
||||
bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, int lineNum) {
|
||||
// ensure no duplicates (except for 'include')
|
||||
if (stmt != STMT_include &&
|
||||
// ensure no duplicates (except for 'include' or 'pad_text')
|
||||
if (stmt != STMT_include && stmt != STMT_pad_text &&
|
||||
(currSeg->fields & (1 << stmt)))
|
||||
util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtNames[stmt]);
|
||||
|
||||
|
|
@ -216,6 +217,8 @@ bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, i
|
|||
|
||||
if (!parse_quoted_string(args, &currSeg->includes[currSeg->includesCount - 1].fpath))
|
||||
util_fatal_error("line %i: invalid filename", lineNum);
|
||||
|
||||
currSeg->includes[currSeg->includesCount - 1].linkerPadding = 0;
|
||||
break;
|
||||
case STMT_increment:
|
||||
if (!parse_number(args, &currSeg->increment))
|
||||
|
|
@ -224,6 +227,9 @@ bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, i
|
|||
case STMT_compress:
|
||||
currSeg->compress = true;
|
||||
break;
|
||||
case STMT_pad_text:
|
||||
currSeg->includes[currSeg->includesCount - 1].linkerPadding += 0x10;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "warning: '%s' is not implemented\n", stmtNames[stmt]);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ typedef enum {
|
|||
STMT_romalign,
|
||||
STMT_stack,
|
||||
STMT_increment,
|
||||
STMT_pad_text,
|
||||
} STMTId;
|
||||
|
||||
enum {
|
||||
|
|
@ -32,6 +33,7 @@ enum {
|
|||
|
||||
struct Include {
|
||||
char* fpath;
|
||||
int linkerPadding;
|
||||
};
|
||||
|
||||
typedef struct Segment {
|
||||
|
|
|
|||
Loading…
Reference in New Issue