----- Original Message -----
> From: "Florian Weimer" <fweimer(a)redhat.com>
> To: "Pavel Valena" <pvalena(a)redhat.com>
> Cc: devel(a)lists.fedoraproject.org
> Sent: Tuesday, May 14, 2019 10:47:41 AM
> Subject: Re: rpmlint: library-not-linked-against-libc (parts of Python stdlib, after
gcc 9)
>
> * Pavel Valena:
>
> > The same occurs with Ruby:
> >
https://src.fedoraproject.org/rpms/ruby/pull-request/44
>
> I'm not sure if this is a false positive. I checked fcntl.so, and it
> references __cxa_finalize, as a weak symbol, so it needs to be linked
> against libc.so.6, for ABI stability.
>
> Can you figure out the linker command line? It could be a binutils bug
> in the implementation of --as-needed.
From Ruby build(rawhide):
https://da.gd/jBhE6
https://copr.fedorainfracloud.org/coprs/pvalena/ruby/build/887856/
```
* LDFLAGS: -L. -Wl,-z,relro -Wl,--as-needed -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-fstack-protector-strong -rdynamic \
-Wl,-export-dynamic
* DLDFLAGS: -Wl,-z,relro -Wl,--as-needed -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld
```
The full command is:
```
gcc -shared -o ../../.ext/x86_64-linux/fcntl.so fcntl.o -L. -L../.. -L. -Wl,-z,relro
-Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
-fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -m64 -lruby -lm -lc
```
________________________________
Wich is different from F29(same SRPM; result linked correctly):
```
* LDFLAGS: -L. -Wl,-z,relro -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-fstack-protector-strong -rdynamic \
-Wl,-export-dynamic
* DLDFLAGS: -Wl,-z,relro -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld
```
```
gcc -shared -o ../../.ext/x86_64-linux/fcntl.so fcntl.o -L. -L../.. -L. -Wl,-z,relro
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong
-rdynamic -Wl,-export-dynamic -Wl,-z,relro -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -m64 -lruby -lm -lc
```
Yes, it's due to the --as-needed change. Problems like this one are
expected. The ELF tooling certainly needs to be updated for this change.
Thanks,
Florian