Discussion:
equivalent of MSVC __declspec(allocate()) or GCC __attribute__((section())) ?
(too old to reply)
Jens Staal
2014-03-03 08:41:47 UTC
Permalink
Dear all,

As I have mentioned in a couple of posts I am trying to build ReactOS with
OW "for fun" (mostly to learn a bit, but if it works that would be cool).

Now I have run into an issue that I don't even know how to name properly in
this file:

https://github.com/staalmannen/reactos/blob/master/include/asm/genincdata.c

my current attempts to modify it can be seen here:

https://github.com/staalmannen/reactos/blob/reactow/include/asm/genincdata.c

If I understand it correctly, the ".asmdef" put in front of the Table[] is
there for it to be interpreted as ASM, and then the included headers in
Table[] contribute with the ASM code. To me it looks _really_ weird, but I
am also a hobbyist with limited knowledge ...

Below are the relevant parts of the problem:

typedef struct
{
char Type;
char Name[55];
ULONGLONG Value;
} ASMGENDATA;

#if defined(_MSC_VER)
#pragma section(".asmdef")
__declspec(allocate(".asmdef"))
#elif defined(__WATCOMC__)
/* what should I put in here? */
#elif defined(__GNUC__)
__attribute__ ((section(".asmdef")))
#else
#error Your compiler is not supported.
#endif

ASMGENDATA Table[] =
{

/* PORTABLE CONSTANTS
********************************************************/
#include "ksx.template.h"

/* ARCHITECTURE SPECIFIC CONTSTANTS
******************************************/
#ifdef _M_IX86
#include "ks386.template.h"
#elif defined(_M_AMD64)
#include "ksamd64.template.h"
#endif

/* End of list */
{TYPE_END, "", 0}
};
Uwe Schmelich
2014-03-03 10:26:26 UTC
Permalink
You may take a look into OW 'User's Guide Help' under '32-bit: The DATA_SEG
Pragma'
IMO it should be something like:

#elif defined(__WATCOMC__)
#pragma data_seg(".asmdef")

Uwe
Post by Jens Staal
Dear all,
As I have mentioned in a couple of posts I am trying to build ReactOS with
OW "for fun" (mostly to learn a bit, but if it works that would be cool).
Now I have run into an issue that I don't even know how to name properly
https://github.com/staalmannen/reactos/blob/master/include/asm/genincdata.c
https://github.com/staalmannen/reactos/blob/reactow/include/asm/genincdata.c
Post by Jens Staal
If I understand it correctly, the ".asmdef" put in front of the Table[] is
there for it to be interpreted as ASM, and then the included headers in
Table[] contribute with the ASM code. To me it looks _really_ weird, but I
am also a hobbyist with limited knowledge ...
typedef struct
{
char Type;
char Name[55];
ULONGLONG Value;
} ASMGENDATA;
#if defined(_MSC_VER)
#pragma section(".asmdef")
__declspec(allocate(".asmdef"))
#elif defined(__WATCOMC__)
/* what should I put in here? */
#elif defined(__GNUC__)
__attribute__ ((section(".asmdef")))
#else
#error Your compiler is not supported.
#endif
ASMGENDATA Table[] =
{
/* PORTABLE CONSTANTS
********************************************************/
#include "ksx.template.h"
/* ARCHITECTURE SPECIFIC CONTSTANTS
******************************************/
#ifdef _M_IX86
#include "ks386.template.h"
#elif defined(_M_AMD64)
#include "ksamd64.template.h"
#endif
/* End of list */
{TYPE_END, "", 0}
};
Loading...