tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] HELP: __attribute__ ((packed)) confusion


From: Christopher Dobbs
Subject: Re: [Tinycc-devel] HELP: __attribute__ ((packed)) confusion
Date: Thu, 10 Feb 2005 01:55:40 -0800
User-agent: Mozilla Thunderbird 0.5 (X11/20040208)

I tried that, still no-go.

One of the data structures is:

typedef struct {                        // 512 byte header
 unsigned char bc[3];                  // Boot Code Signature
 unsigned char signature[8];           // signature string "LIBV10"
 unsigned long dir;                    // offset of first dir block
 unsigned long freechain;              // offset of first block
 unsigned long eof;                    // offset of end of freechain
 unsigned char label[41];              // Volume Label
 unsigned long attr;                   // Volume Attributes
 char          passcode[16];           // Volume Password
 unsigned char fill[428];              // Filler
} PACKED header;

I use the following macro:

#define PACKED __attribute__ ((__packed__))

I have tried placing PACKED before, after, and in the middle of each members of the structure, before each of typedef, struct, and the opening bracket.

This structure as shown above, compiles under gcc at 512 bytes, but no matter what I try, I get 516 bytes under tcc.

I really want to use tcc instead of gcc.

Any further ideas?
I am willing to help hack the source if some one can point me in the right direction.

I need this feature because of many projects I have that require on-disk structures to be of a curtian layout.

PLEASE HELP!!!!

--
Christopher Dobbs

Fabrice Bellard wrote:

Hi,

In TCC 'packed' is supported only for structure fields or variable declarations, not for a whole structure. So a solution for you is to add it to each field of the packed structure.

Fabrice.

Christopher Dobbs wrote:

I need __attribute__ ((packed)) to work.
The docs say that it does.
Here is a snippit of code that I am using:

#define PACKED __attribute__ ((packed))

typedef struct {
 ...
} PACKED MyStruct_;

The structure is to be 512 bytes in size, but comes out 516.
If I recompile using gcc, all is how it should be.

I would rather use tcc, but this and a few other projects require packed
structures.

Thanks in advance for any help.

--
Christopher Dobbs


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel





_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel






reply via email to

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