tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] alinged/unaligned on OpenBSD


From: Herman ten Brugge
Subject: Re: [Tinycc-devel] alinged/unaligned on OpenBSD
Date: Mon, 25 Jan 2021 09:17:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 1/25/21 7:57 AM, Christian Jullien wrote:

Hi Grischka,

Your last commit reverted alignment code introduced to support OpenBSD on arm.

Even it looks strange for you, as confirmed by an OpenBSD developer, arm by design requires alignment.

Your commit breaks the test suite:

Test: 96_nodata_wanted...

Bus error (core dumped)

--- 96_nodata_wanted.expect     Mon Jan 25 00:56:49 2021

+++ 96_nodata_wanted.output     Mon Jan 25 01:34:37 2021

@@ -12,15 +12,3 @@

96_nodata_wanted.c:25: warning: cast between pointer and integer of different size

 

[test_data_suppression_off]

-data:

-  8 - 8.0 - 8.0 - main - static string

-  333 44 555555 6 7

-size of data/text:

-  non-zero/non-zero

-

-[test_data_suppression_on]

-size of data/text:

-  zero/zero

-

-[test_static_data]

-a = 1

 

 

FYI, with Herman (esp. Herman) we added OpenBSD support for i386/x86_64/arm/arm64 which passed all the test. The good news is that tcc is now an official OpenBSD package which is great for the TinyCC popularity.

If, for probably good reasons, you don’t want alignment code for all platforms, can we add a new configuration option: --align or alike which will force alignment?

 

Grischka removed correctly my code in struct_layout. I made a mistake here.

The problem in testcase 96 is that the packed structure is put at an unaligned position on the stack and I tried to use single byte to solve this.
The problem is that packed structeres should probably always use single_byte code.
For example:
-----
struct __attribute__((packed)) {
  char a;      
  int b;   
} s;           
           
int            
main(void) 
{              
  s.b = 3; 
}
-----
Also fails to run on arm32 (openbsd).
I do not have a solution. But maybe Grischka can solve this?

    Herman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]