This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM335X: Linker Errors Converting from TI to GNUC

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: SYSBIOS

Hello,

I have a massive project that I an updating from TI 17.3.0 STS to GNUC 7.3.1.  After weeks of updating code to handle the stricter and tighter syntax in the GNU compiler, I now have linker errors.

This is a SYSBIOS 6.46.5.55 and XDC 3.32.2.25 project.

I have CHECKED "Do not use standard system..."   "Do not link with the shared..."  and "Remove unused sections" in the linker section, because a generic SYSBIOS project of the same packages has those checked as well.

Although for this project, I had to add stdc++ which the generic SYSBIOS project didn't have (and yet that, as well as others, do not show in the output console???)

After a dozen searches, trials, and errors of various settings (which I can't get any explanation of what they do...  just to set it), I got it down to these two missing references:

---------------------------------------------------------------------------

C:\source\....\src\sysbios\sysbios.aa8fg(gnu_ReentSupport.o): In function `ti_sysbios_rts_gnu_ReentSupport_Module_startup__E':
C:/ti/bios_6_46_05_55/packages/ti/sysbios/rts/gnu/ReentSupport.c:83: undefined reference to `ti_sysbios_rts_gnu_ReentSupport_checkIfCorrectLibrary'

c:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/hard\libstdc++_nano.a(locale_init.o): In function `(anonymous namespace)::get_locale_mutex()':
locale_init.cc:(.text._ZN12_GLOBAL__N_116get_locale_mutexEv+0xc): undefined reference to `__sync_synchronize'

c:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/hard\libstdc++_nano.a(locale.o): In function `std::locale::_Impl::_M_install_cache(std::locale::facet const*, unsigned int)':
locale.cc:(.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEj+0x18): undefined reference to `__sync_synchronize'
collect2.exe: error: ld returned 1 exit status

-------------------------------------------------------------------

(I had to paste this directly in, because the web site is perpetually broken, and no one cares...  Inserting code gives me "access denied")

These are NOT reference in our project.  They are CCS libraries looking for stuff in other CCS libraries.

The linker command is:

----------------------------------------------------------------

Building target: "{name}.out"
Invoking: GNU Linker
Flags: -mtune=cortex-a8 -Dam3359 -D...  snipped

-Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"{name}.map" -nostartfiles -static -Wl,--gc-sections

-L"C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu"
-L"C:/.../WolfSSL-4-7/Release__GNU"
--specs=nano.specs
"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc-7.3.1.exe"
@"ccsLinker.opt" -o"{name}.out"

----------------------------------------------------------------

Oddly enough, when I change the linker libraries in the settings from 

${xdc_find:gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu:${ProjName}}

to 

${xdc_find:gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard:${ProjName}}

One of the linker lines disappears!  But I still have the exact same errors (missing references)

--------------------------------------------------------------

Building target: "{name}.out"
Invoking: GNU Linker
Flags: -mtune=cortex-a8 -Dam3359 -D...

-Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"{name}.map" -nostartfiles -static -Wl,--gc-sections    
     (the  ....arm-none-eabi/lib/fpu" line is now gone... not replaced with 'hard' ??!!)
-L"C:/.../WolfSSL-4-7/Release__GNU"
--specs=nano.specs
"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc-7.3.1.exe"

@"ccsLinker.opt" -o"{name}.out"

------------------------------------------------------------------

Now then...  This page:  e2e.ti.com/.../rtos-sysbios-gnu-linker-error-with-sysbios-v06-52-00-12

simply says to go to this page: software-dl.ti.com/.../FAQ.html

Which is useless, because it says " and not using CCS."   Well, I am using CCS.  It also says " make sure that you are using libc, libgcc, libm, etc. "  Well, what is "etc" ??  And is CCS failing to include whatever those "etc" libraries are?

The libs I have listed are ${COM_TI_BIOS_LIBRARIES}  gcc  m  nosys  stdc++  c  WolfSSL-4-7  (although the last one isn't relevant to this issue)

It also then sends me to this page: e2e.ti.com/.../3109064

Which doesn't seems to address the issue from the second page, let alone solve it for the first post.

As is typical of this environment, I can create or import a new SYSBIOS project and it builds. But I cannot alter an existing one without requiring a doctorate in this environment.  We are not starting from scratch with hundreds and hundreds of source files.

Can anyone tell me where to look?  What is missing?  What setting to turn on or off?

Does anyone know how this works?  (My last post was "I don't why it does X, but you can get around it by doing Y ")

-CSW

  • Hi Christopher,

    Let me provide the CCS project settings below from a PDK example project that builds fine with GNU 7.3.1.

    1. GNU Compiler:

    -mcpu=cortex-a8 -march=armv7-a -mtune=cortex-a8 -marm -mfloat-abi=hard -Dam3359 
    -DUSE_BIOS -DSOC_AM335x -DbbbAM335x 
    -I"C:/ti/pdk_am335x_1_0_17/packages/MyExampleProjects/GPIO_LedBlink_bbbAM335x_armTestProject" 
    -I"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/arm-none-eabi/include/newlib-nano" 
    -I"C:/ti/pdk_am335x_1_0_17/packages/ti/drv/gpio" 
    -I"C:/ti/pdk_am335x_1_0_17/packages" -I"/packages" 
    -I"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/arm-none-eabi/include" 
    -Og -g -gdwarf-3 -gstrict-dwarf -Wall -c -finstrument-functions -MMD -MP

    2. GNU Linker:

    -mtune=cortex-a8 -marm -Dam3359 -DUSE_BIOS -DSOC_AM335x -DbbbAM335x -Og -g 
    -gdwarf-3 -gstrict-dwarf -Wall -finstrument-functions -MMD -MP 
    -mfloat-abi=hard -Wl,-Map,"GPIO_LedBlink_bbbAM335x_armTestProject.map" 
    -nostartfiles -static -Wl,--gc-sections 
    -L"C:/ti/bios_6_76_03_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" 
    -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs

    You can compare with the settings of your project and see what is missing.

    Also, it seems that you had a solution posted in this thread. Does it apply to your current problem?

    Regarding the E2E server problem you mentioned:

    (I had to paste this directly in, because the web site is perpetually broken, and no one cares...  Inserting code gives me "access denied")

    I don't have any problem with inserting code and haven't seen any reports from other users about this feature. This may be an isolated issue with your web browser. Maybe try a different browser?

    Regards,

    Jianzhong

  • I don't have any problem with inserting code and haven't seen any reports from other users about this feature. This may be an isolated issue with your web browser. Maybe try a different browser?

    Perhaps it is because all of us have been trained to not bother complaining, as the site is loaded with defects...

    Well, I can paste simple text that I wrote by hand...

    The TI E2E web site is loaded with defects...
    

    But when I pasted in a compiler output, it gives me this:

    I've experienced this on multiple machines, multiple browsers.  Please don't blame my toolset.

  • Jianzhong,

    That link was using newer SYSBIOS and XDC, if you looked at my post.

    It was also a precursor to this step I am doing now.  (step 1: convert to GNU, step 2: update SYSBIOS and XDC, step 3: other packages)

    I am only on step 1...

    You can compare with the settings of your project and see what is missing.

    I've been doing that.  To at least half a dozen little test projects, trying to find the difference.  As usual, the little sample projects are useless, as they are missing all kinds of stuff we encounter in a real program...

    But I did repeatedly insert new functionality into one of the little sample projects.

    I managed to find one:   When I include stdc++ lib, I get the first unresolved:

    C:/ti/bios_6_46_05_55/packages/ti/sysbios/rts/gnu/ReentSupport.c:83: undefined reference to `ti_sysbios_rts_gnu_ReentSupport_checkIfCorrectLibrary'

    (Which, for some unpredictable reason, I was able to this diagnostic output insert as code...)

    So, now that I've troubleshot this more...  what is in the stdc++ lib that demands the presence of  the function ti_sysbios_rts_gnu_ReentSupport_checkIfCorrectLibrary?

    Where do I get it?

    Why isn't this documented anywhere (except a web page that blames users for not using CCS... when they are)?

    Please do NOT tell me to not use stdc++.  The use of std::string is used all over this project.  It is used with the TI compiler 17.3.0 STS...  Removing it is NOT an option.)

    And this doesn't get me any closer to finding what/where the solution is for the missing __sync_synchronize reference...

  • Let me loop in CCS and compiler experts for help.

  • Jianzhong,

    Apparently, GNUC 7.3 is not supported in SYSBIOS 6_46_05_55/XDC 3_32_02_25

    It is necessary to use SYSBIOS 6_76_01_01/XDC 3_55_02_22

    This means the major project now must be updated to those packages concurrently.

  • Hi Christopher,

    Thank you for sharing the update.

    Best regards,

    Jianzhong