Page MenuHomeVyOS Platform

Bullseye: gcc defaults to passing --as-needed to linker
Closed, ResolvedPublicFEATURE REQUEST

Description

In Bullseye, gcc now passes the option '--as-needed' to the linker by default. This option allows the linker to ignore those libraries supplied on the command line whose symbols are not used by the lib or program being created; however, 'symbols used' are evaluated at that point in the command line, so this will work:

gcc -o dumb dumb.c -lprce

assuming dumb invokes a pcre lib function; this will not work:

gcc -lpcre -o dumb dumb.c

A quick fix was provided for 'ipaddrcheck' in commit 5d5be019 by passing '--no-as-needed'. A more proper fix is obtained by only adding linked libs to packagename_LDADD, instead of packagename_LDFLAGS, as mentioned here:

https://wiki.debian.org/ToolChain/DSOLinking#Unresolved_symbols_in_shared_libraries

The revised fix will be added to src/Makefile.am in ipaddrcheck

Details

Difficulty level
Easy (less than an hour)
Version
vyos-1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Related Objects

Event Timeline

jestabro changed the task status from Open to In progress.Jun 23 2021, 4:47 PM
jestabro triaged this task as High priority.
jestabro created this task.
jestabro created this object in space S1 VyOS Public.
jestabro moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.