This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: section attribute of compound literals


Hi Jim,

On Thu, Sep 13, 2018 at 10:39 PM Jim Wilson <jimw@sifive.com> wrote:
> The
> compound literal could have an address, but we don't have a way to
> attach attributes to compound literals.

Thanks for the confirmation of the problem.

> Since your testcase already has a symbol in the right section, you could
> just use that to initialize breaks.
> const u8 *breaks = works;
> This means defining a bunch of extra symbols, but is a potential
> solution to your problem.

I'm not sure I see a clean way of defining the symbol inline with my
massive struct initialization. For example:

static const struct chacha20poly1305_testvec
chacha20poly1305_enc_vectors[] __stuffdata = { {
    .key    = (u8[]){ 0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a,
                      0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0,
                      0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80, 0x09,
                      0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70, 0x75, 0xc0 },
    .nonce  = (u8[]){ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 },
    .nlen   = 8,
    .assoc  = (u8[]){ 0xf3, 0x33, 0x88, 0x86, 0x00, 0x00, 0x00, 0x00,
                      0x00, 0x00, 0x4e, 0x91 },
...

Assuming this is an array of a huge amount of
chacha20poly1305_testvec, I'm not sure if there's a syntax for me to
define the symbol inline with the declarations. Any ideas?

Regards,
Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]