- To: gcc-help@xxxxxxx
- Subject: alias of structure members
- From: Ángel González <keisial@xxxxxxxxx>
- Date: Sat, 11 Feb 2012 22:36:11 +0100
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329600707; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Message-ID:Date:From: User-Agent:MIME-Version:To:Subject:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=4MzdC93R5EayjKxRvpxm7tZfSx8=; b=St/qJKf8w2AfvhM LJ9Gq7X8PRFaWC40Wfkud6v6fZorcxQUXoNZiapYyUnM++ubUSr1bKcwxdL9kAkm 6Q6beIC1fk14hu69Pbo8e+0xk44EOraEKDnHtfJl5lSewgMt9030TBoWcKSojV94 qfiF6B+NGT3hQnAhH8nV5h7FSyhg=
- User-agent: Thunderbird
I'm trying to define some symbols which are just alias to the struct
members of
a global/static variable.
See testcase below:
struct Foo_struct {
int Foodata;
} Foo;
extern int __attribute__((alias("Foo.Foodata"))) Localfoo;
struct Bar_struct {
int Bardata;
};
struct Bar_struct Bar;
extern int __attribute__((alias("Bar.Bardata"))) Localbar;
struct Baz_struct {
int Bazdata[4];
};
struct Baz_struct Baz;
extern int __attribute__((alias("Baz.Bazdata"))) Localbaz[4];
int main() {}
This syntax works fine in gcc 3.4 but seems to have disappeared in gcc4,
where it complains that the symbol is aliased to undefined symbol.
It may be trying to find it with a mangled name, as that's what you are
supposed to use in alias, but I didn't find it. The trick of looking at
the symbols in the object file doesn't work in this case, as obviously
the structure members don't get symbols. I wouldn't get surprised if not
working from another file, but I'm trying to do that from the same
translation unit. Such thing was possible to do in earlier versions, and
being an extension, there's no "standard conformance" which could be
banning it. So I see no reason to not allow it.
How should that be done now?
Thanks
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]