Why do I get compilation error while using type attribute?
Issue
- How to use type attribute
__align
in Red Hat Linux? - The following code snippet compiled on
AIX
usinggcc v4.1
#pragma nostandard
GLOBAL GBLCOM __align(PAGE) gblcom;
GLOBAL VOLCOM __align(PAGE) volcom;
GLOBAL GAMCOM __align(PAGE) gamcom;
GLOBAL ADDCOM __align(PAGE) addcom;
GLOBAL LOGCOM __align(PAGE) logcom;
GLOBAL LFDCOM __align(PAGE) lfdcom;
#pragma standard
The __align
does not seem to be supported by the gcc
compiler v 4.8
on Linux
I had to make the following changes ( not sure if they are correct) in order to compile on Linux using gcc v4.8
#pragma nostandard
GLOBAL GBLCOM __attribute__ ((__align(PAGE))) gblcom;
GLOBAL VOLCOM __attribute__ ((__align(PAGE))) volcom;
GLOBAL GAMCOM __attribute__ ((__align(PAGE))) gamcom;
GLOBAL ADDCOM __attribute__ ((__align(PAGE))) addcom;
GLOBAL LOGCOM __attribute__ ((__align(PAGE))) logcom;
GLOBAL LFDCOM __attribute__ ((__align(PAGE))) lfdcom;
#pragma standard
I get the following warnings (see below) when I compile the above
^
In file included from /usr/users/dsimoncig/olgs/l649private/game_proto.h:71:0,
from l649tran.c:70:
/usr/users/dsimoncig/olgs/laslpublic/lasl_gameglob.h:39:5: warning: ‘__align’ attribute directive ignored [-Wattributes]
GLOBAL GBLCOM __attribute__ ((__align(PAGE))) gblcom;
^
/usr/users/dsimoncig/olgs/laslpublic/lasl_gameglob.h:40:5: warning: ‘__align’ attribute directive ignored [-Wattributes]
GLOBAL VOLCOM __attribute__ ((__align(PAGE))) volcom;
^
/usr/users/dsimoncig/olgs/laslpublic/lasl_gameglob.h:41:5: warning: ‘__align’ attribute directive ignored [-Wattributes]
GLOBAL GAMCOM __attribute__ ((__align(PAGE))) gamcom;
^
/usr/users/dsimoncig/olgs/laslpublic/lasl_gameglob.h:42:5: warning: ‘__align’ attribute directive ignored [-Wattributes]
GLOBAL ADDCOM __attribute__ ((__align(PAGE))) addcom;
^
/usr/users/dsimoncig/olgs/laslpublic/lasl_gameglob.h:43:5: warning: ‘__align’ attribute directive ignored [-Wattributes]
GLOBAL LOGCOM __attribute__ ((__align(PAGE))) logcom;
^
/usr/users/dsimoncig/olgs/laslpublic/lasl_gameglob.h:44:5: warning: ‘__align’ attribute directive ignored [-Wattributes]
GLOBAL LFDCOM __attribute__ ((__align(PAGE))) lfdcom;
Environment
- Red Hat Enterprise Linux 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.