[LAD] G++ trouble

From: Fons Adriaensen <fons@email-addr-hidden>
Date: Mon Nov 16 2020 - 10:43:42 EET

Hello all,

I'm having a strange problem with G++...

In one source file 'fb3data.cc', I define arrays like this:

    const float svcoeff44 [216] =
    {
         1.631996e-03, 6.335480e-02, ...
         ...
    };

There are five of these. In 'fbdata3.h' I have

    extern const float svcoeff44 [216];
    extern const float svcoeff48 [216];
    extern const float svcoeff88 [216];
    ...

Finally in 'filtbank3.cc' there is

    const float *c;

    switch (fsam)
    {
    case 44100:
        c = cvcoeff44;
        break;
    case 48000:
        c = cvcoeff48;
        break;
    ...
    }

Everything compiles without errors or warnings, but the linking
step fails:

/usr/bin/ld: filtbank3.o: warning: relocation against `svcoeff88' in read-only section `.text'
/usr/bin/ld: filtbank3.o: in function `VocFiltbank::init(int)':
filtbank3.cc:(.text+0x159): undefined reference to `svcoeff192'
/usr/bin/ld: filtbank3.cc:(.text+0x1d3): undefined reference to `svcoeff48'
/usr/bin/ld: filtbank3.cc:(.text+0x1e3): undefined reference to `svcoeff96'
/usr/bin/ld: filtbank3.cc:(.text+0x1f3): undefined reference to `svcoeff44'
/usr/bin/ld: filtbank3.cc:(.text+0x1ff): undefined reference to `svcoeff88'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

When I put the arrays in 'filtbank3.cc' instead, everything works.

Any hints ??

Ciao,

-- 
FA
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Nov 17 04:15:02 2020

This archive was generated by hypermail 2.1.8 : Tue Nov 17 2020 - 04:15:02 EET