2

I am working on a small C++ project. After a while my code started producing the following warnings when compiled and run in debug mode:

BFD: warning: /root/Projects/TestProject: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000002
BFD: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000002
BFD: warning: /lib/x86_64-linux-gnu/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000002
BFD: warning: /lib/x86_64-linux-gnu/libc.so.6: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000002

I am not sure why these warnings show up or what exactly they mean. The application seems to run fine even with these errors. Is there any information about these warnings?

I am on Ubuntu 20.04 and the used GCC version is gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04). The project needs to be run as root for user (if that might matter.)

I am using the __builtin_popcount function somewhere in my code. I noticed that by commenting the line of code containing this function 1 warning disappears:

BFD: warning: /lib/x86_64-linux-gnu/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000002

The project is compiled with the following commands:

/usr/bin/c++    -g   -std=gnu++11 -o CMakeFiles/project.dir/src/main.cpp.o -c /root/Projects/TestProject/src/main.cpp

/usr/bin/c++    -g   -std=gnu++11 -o CMakeFiles/project.dir/src/file1.cpp.o -c /root/Projects/TestProject/src/file1.cpp

/usr/bin/c++    -g   -std=gnu++11 -o CMakeFiles/project.dir/src/file2.cpp.o -c /root/Projects/TestProject/src/file2.cpp

/usr/bin/c++  -g   CMakeFiles/project.dir/src/main.cpp.o CMakeFiles/project.dir/src/file1.cpp.o CMakeFiles/project.dir/src/file2.cpp.o   -o TestApplication

ld version:

$ ld.bfd -v
GNU ld (GNU Binutils for Ubuntu) 2.34

Edit:

Tried linking with gold

/usr/bin/c++ -fuse-ld=gold -g   CMakeFiles/project.dir/src/main.cpp.o CMakeFiles/project.dir/src/file1.cpp.o CMakeFiles/project.dir/src/file2.cpp.o   -o TestApplication

This produces the same warnings. No extra information is given.

gold version:

$ gold -v
GNU gold (GNU Binutils for Ubuntu 2.34) 1.16
4
  • Linking your code with a different linker, such as lld or gold, instead of the default ld.bfd might give you a better insight on what is happening with your code. In order to get the compiler to link using a different linker, try invoking gcc or clang with -fuse-ld=lld or -fuse-ld=gold
    – mcilloni
    Commented Apr 30, 2021 at 20:44
  • Also, it might help knowing what version of ld.bfd you are using. In my experience these kinds of warning start to happen when the linker is too old.
    – mcilloni
    Commented Apr 30, 2021 at 20:48
  • Added ld version and tested with gold linker. Same results...
    – eKKiM
    Commented Apr 30, 2021 at 21:01
  • 2
    Check if you are mixing libraries built with different versions of compiler
    – def
    Commented Feb 1, 2022 at 20:04

2 Answers 2

3

I also ran into this compilation warning because I installed binutils-2.38 from the source code. It replaces files under /usr/local/bin, such as ld. When I rolled back to binutils-2.30, the problem was solved. BTW, my system is Ubuntu 18.04.

-1

I resolved this by using:

sudo apt install cmake

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.