fix for: x86_64-tcc compiled by i386-tcc is wrong

A test program (must be compiled by the above version of the tcc):

    /* Tickle a bug in TinyC on 64-bit systems:
     * the LSB of the top word or ARGP gets set
     * for no obvious reason.
     *
     * Source: a legacy language interpreter which
     * has a little stack / stack pointer for arguments.
     *
     * Output is: 0x8049620 0x10804961c
     * Should be: 0x8049620 0x804961c
     */
    #include <stdio.h>
    #define NARGS 20000
    int ARG[NARGS];
    int *ARGSPACE = ARG;
    int *ARGP = ARG - 1;
    main() { printf("%p %p\n", ARGSPACE, ARGP); }
This commit is contained in:
seyko
2015-03-23 19:24:55 +03:00
parent 8dbe129ab7
commit 8f6390061d
3 changed files with 4 additions and 4 deletions

View File

@ -270,7 +270,7 @@ ST_FUNC int add_elf_sym(Section *s, addr_t value, unsigned long size,
/* put relocation */
ST_FUNC void put_elf_reloca(Section *symtab, Section *s, unsigned long offset,
int type, int symbol, unsigned long addend)
int type, int symbol, addr_t addend)
{
char buf[256];
Section *sr;