[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] tcc as compiler for tccboot
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] tcc as compiler for tccboot |
Date: |
Fri, 22 Apr 2016 15:38:36 +0200 (CEST) |
User-agent: |
Alpine 2.20 (LSU 67 2015-01-07) |
Hi,
On Wed, 20 Apr 2016, Sergey Korshunoff wrote:
> > Just checked. I used a hex editor to replace a 0x20 bytes in mem-2.o with
> > 0x04.
> > This helped.
>
> diff --git a/libtcc.c b/libtcc.c
> index 5aebd32..a8e109c 100644
> --- a/libtcc.c
> +++ b/libtcc.c
> @@ -514,7 +514,11 @@ ST_FUNC Section *new_section(TCCState *s1, const
> char *name, int sh_type, int sh
> sec->sh_addralign = 1;
> break;
> default:
> + #ifdef TCC_TARGET_I386
> + sec->sh_addralign = 4; /* gcc/pcc default alignment for i386 */
> + #else
> sec->sh_addralign = 32; /* default conservative alignment */
> + #endif
> break;
A nicer default that will work for all our architectures is 'PTR_SIZE'.
The 32 comes from Fabrices original tcc implementation, at which point you
couldn't yet specify alignment for decls (or sections) explicitely, and
some needed larger alignment than pointer sizes. This isn't the case
anymore, section alignment is updated as needed. So reducing to something
sensible is possible now.
Please go with PTR_SIZE and no #ifdefery.
Ciao,
Michael.
- [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/20
- Re: [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/20
- Re: [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/20
- Re: [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/20
- Re: [Tinycc-devel] tcc as compiler for tccboot, David Mertens, 2016/04/20
- Re: [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/21
- Re: [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/21
- Re: [Tinycc-devel] tcc as compiler for tccboot, David Mertens, 2016/04/21
- Re: [Tinycc-devel] tcc as compiler for tccboot, Sergey Korshunoff, 2016/04/22
- Re: [Tinycc-devel] tcc as compiler for tccboot,
Michael Matz <=