diff -u -r a/tinycc-20a1ebf/i386-link.c b/tinycc-20a1ebf/i386-link.c --- a/tinycc-20a1ebf/i386-link.c 2022-08-18 09:34:36.000000000 +0000 +++ b/tinycc-20a1ebf/i386-link.c 2023-02-03 13:07:51.488566020 +0000 @@ -12,7 +12,7 @@ #define R_NUM R_386_NUM -#define ELF_START_ADDR 0x08048000 +#define ELF_START_ADDR 0 #define ELF_PAGE_SIZE 0x1000 #define PCRELATIVE_DLLPLT 0 Only in b/tinycc-20a1ebf: i386-link.c. Only in b/tinycc-20a1ebf: i386-link.c_ diff -u -r a/tinycc-20a1ebf/libtcc.c b/tinycc-20a1ebf/libtcc.c --- a/tinycc-20a1ebf/libtcc.c 2022-08-18 09:34:36.000000000 +0000 +++ b/tinycc-20a1ebf/libtcc.c 2023-02-03 13:07:51.468566019 +0000 @@ -818,6 +818,8 @@ s->ppfp = stdout; /* might be used in error() before preprocess_start() */ s->include_stack_ptr = s->include_stack; + /* do not try dynamic linking on this platform */ + s->static_link = 1; tccelf_new(s); diff -u -r a/tinycc-20a1ebf/tcc.c b/tinycc-20a1ebf/tcc.c --- a/tinycc-20a1ebf/tcc.c 2022-08-18 09:34:36.000000000 +0000 +++ b/tinycc-20a1ebf/tcc.c 2023-02-03 13:07:51.456566019 +0000 @@ -397,6 +397,15 @@ if (done && 0 == t && 0 == ret && s->do_bench) tcc_print_stats(s, end_time - start_time); +#ifdef TCC_GENERATE_AOUT + { int e2a; + if (s->output_type == TCC_OUTPUT_EXE) { + if ((e2a = elf2aout(s->outfile)) != 0) + return e2a; + } + } +#endif + tcc_delete(s); if (!done) goto redo; /* compile more files with -c */ diff -u -r a/tinycc-20a1ebf/tccgen.c b/tinycc-20a1ebf/tccgen.c --- a/tinycc-20a1ebf/tccgen.c 2022-08-18 09:34:36.000000000 +0000 +++ b/tinycc-20a1ebf/tccgen.c 2023-02-03 13:07:51.476566020 +0000 @@ -1731,7 +1731,7 @@ (vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { /* CPUs usually cannot use float constants, so we store them generically in data segment */ - init_params p = { rodata_section }; + init_params p = { data_section }; unsigned long offset; size = type_size(&vtop->type, &align); if (NODATA_WANTED) @@ -5344,7 +5344,7 @@ mk_pointer(&type); type.t |= VT_ARRAY; type.ref->c = len; - sec = rodata_section; + sec = data_section; vpush_ref(&type, sec, sec->data_offset, len); if (!NODATA_WANTED) memcpy(section_ptr_add(sec, len), funcname, len); @@ -5368,7 +5368,7 @@ mk_pointer(&type); type.t |= VT_ARRAY; memset(&ad, 0, sizeof(AttributeDef)); - ad.section = rodata_section; + ad.section = data_section; decl_initializer_alloc(&type, &ad, VT_CONST, 2, 0, 0); break; case '(': @@ -7944,7 +7944,7 @@ while ((tp->t & (VT_BTYPE|VT_ARRAY)) == (VT_PTR|VT_ARRAY)) tp = &tp->ref->type; if (tp->t & VT_CONSTANT) { - sec = rodata_section; + sec = data_section; } else if (has_init) { sec = data_section; /*if (tcc_state->g_debug & 4) diff -u -r a/tinycc-20a1ebf/tcc.h b/tinycc-20a1ebf/tcc.h --- a/tinycc-20a1ebf/tcc.h 2022-08-18 09:34:36.000000000 +0000 +++ b/tinycc-20a1ebf/tcc.h 2023-02-03 13:07:51.436566019 +0000 @@ -1815,6 +1815,12 @@ #define dwarf_str_section s1->dwarf_str_section #define dwarf_line_str_section s1->dwarf_line_str_section +/* ------------ elf2aout.c ------------ */ +#ifdef TCC_GENERATE_AOUT +PUB_FUNC int elf2aout(const char *elf); +#endif + + #ifndef DWARF_VERSION # define DWARF_VERSION 0 #endif