public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Rocky Linux sys_nerr, sys_errlist deprecation
@ 2025-02-03 15:27 Arian Cabrera
  2025-02-03 20:41 ` Sam James
  0 siblings, 1 reply; 3+ messages in thread
From: Arian Cabrera @ 2025-02-03 15:27 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 6212 bytes --]

To whom it may concern,

I wanted to raise a question, regarding binutils-devel shipping libiberty
library with deprecated functions (sys_nerr, sys_errlist) causing the
following errors in Rocky Linux versions using glibbc 2.32 and up.

Why the following doesn't work, if binutils ships liberty specifically for
this? Correct?
Any workaround? If the workaround is to change code and move away from
using liberty, could you please explain the reason why?

Thanks before hand!!

------------------------------
The error we get:

/usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libiberty.a(strerror.o):
in function errno_max':
/builddir/build/BUILD/binutils-2.35.2/build-x86_64-redhat-linux/libiberty/../../libiberty/strerror.c:600:
undefined reference to sys_nerr'

Reproduction Steps:

Create file:
$vi errno_max.c
$ cat errno_max.c
#include <stdio.h>
#include <errno.h>
#include <libiberty.h>
int main() {
    int max_errno = errno_max();
    printf("The maximum value of errno is: %d\n", max_errno);
    return 0;
}

Run:
gcc -o errno_max errno_max.c -liberty

Debug version (-v)
gcc -o errno_max errno_max.c /usr/lib64/libiberty.a
/usr/bin/ld: /usr/lib64/libiberty.a(strerror.o): in function errno_max':
/builddir/build/BUILD/binutils-2.35.2/build-x86_64-redhat-linux/libiberty/../../libiberty/strerror.c:600:
undefined reference tosys_nerr'
collect2: error: ld returned 1 exit status
[root@localhost ~]# gcc -o errno_max errno_max.c -liberty -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-host-pie
--enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=
https://bugs.rockylinux.org/ --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-gcc-major-version-only --enable-plugin
--enable-initfini-array --without-isl --enable-multilib
--with-linker-hash-style=gnu --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64
--build=x86_64-redhat-linux --with-build-config=bootstrap-lto
--enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.5.0 20240719 (Red Hat 11.5.0-2) (GCC)
COLLECT_GCC_OPTIONS='-o' 'errno_max' '-v' '-mtune=generic'
'-march=x86-64-v2'
/usr/libexec/gcc/x86_64-redhat-linux/11/cc1 -quiet -v errno_max.c -quiet
-dumpbase errno_max.c -dumpbase-ext .c -mtune=generic -march=x86-64-v2
-version -o /tmp/ccuHbsxT.s
GNU C17 (GCC) version 11.5.0 20240719 (Red Hat 11.5.0-2)
(x86_64-redhat-linux)
compiled by GNU C version 11.5.0 20240719 (Red Hat 11.5.0-2), GMP version
6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/11/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/11/../../../../x86_64-redhat-linux/include"
include "…" search starts here:
include <…> search starts here:
/usr/lib/gcc/x86_64-redhat-linux/11/include
/usr/local/include
/usr/include
End of search list.
GNU C17 (GCC) version 11.5.0 20240719 (Red Hat 11.5.0-2)
(x86_64-redhat-linux)
compiled by GNU C version 11.5.0 20240719 (Red Hat 11.5.0-2), GMP version
6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 519d0e643a1f182db008ad234ddca59c
COLLECT_GCC_OPTIONS='-o' 'errno_max' '-v' '-mtune=generic'
'-march=x86-64-v2'
as -v --64 -o /tmp/ccuT5lPu.o /tmp/ccuHbsxT.s
GNU assembler version 2.35.2 (x86_64-redhat-linux) using BFD version
version 2.35.2-54.el9
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/11/:/usr/libexec/gcc/x86_64-redhat-linux/11/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/11/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/11/:/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/11/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-o' 'errno_max' '-v' '-mtune=generic'
'-march=x86-64-v2' '-dumpdir' 'errno_max.'
/usr/libexec/gcc/x86_64-redhat-linux/11/collect2 -plugin
/usr/libexec/gcc/x86_64-redhat-linux/11/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccyV9Cjs.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o errno_max
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/11/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/11
-L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../..
/tmp/ccuT5lPu.o -liberty -lgcc --push-state --as-needed -lgcc_s --pop-state
-lc -lgcc --push-state --as-needed -lgcc_s --pop-state
/usr/lib/gcc/x86_64-redhat-linux/11/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crtn.o
/usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libiberty.a(strerror.o):
in function errno_max':
/builddir/build/BUILD/binutils-2.35.2/build-x86_64-redhat-linux/libiberty/../../libiberty/strerror.c:600:
undefined reference to sys_nerr'

collect2: error: ld returned 1 exit status

Arian Cabrera

*Customer Support Engineer*

*P* 510 9880618 #558 | *E* acabrera@ciq.com  | *W* ciq.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Rocky Linux sys_nerr, sys_errlist deprecation
  2025-02-03 15:27 Rocky Linux sys_nerr, sys_errlist deprecation Arian Cabrera
@ 2025-02-03 20:41 ` Sam James
  2025-02-03 20:49   ` Arian Cabrera
  0 siblings, 1 reply; 3+ messages in thread
From: Sam James @ 2025-02-03 20:41 UTC (permalink / raw)
  To: Arian Cabrera; +Cc: binutils

Arian Cabrera <acabrera@ciq.com> writes:

> To whom it may concern,
>
> I wanted to raise a question, regarding binutils-devel shipping libiberty library with deprecated functions (sys_nerr,
> sys_errlist) causing the following errors in Rocky Linux versions using glibbc 2.32 and up. 

Note that libiberty isn't really supposed to be a public library at all,
it's really intended to be used statically linked within a project like
binutils or gcc.

>
> Why the following doesn't work, if binutils ships liberty specifically for this? Correct? 
> Any workaround? If the workaround is to change code and move away from using liberty, could you please explain the reason
> why? 

I suspect it's because the libiberty config.h isn't being included so it
doesn't know it needs to define the fallbacks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Rocky Linux sys_nerr, sys_errlist deprecation
  2025-02-03 20:41 ` Sam James
@ 2025-02-03 20:49   ` Arian Cabrera
  0 siblings, 0 replies; 3+ messages in thread
From: Arian Cabrera @ 2025-02-03 20:49 UTC (permalink / raw)
  To: Sam James; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

Thanks for your response Sam,

I am using the binutils-devel binary (binutils-devel   x86_64
      2.35.2-54.el9) which ships the libiberty library.

I tried adding config.h but instead got this error:

test.c:4:10: fatal error: config.h: No such file or directory
    4 | #include <config.h>
      |          ^~~~~~~~~~
compilation terminated.

Arian Cabrera

*Customer Support Engineer*

*P* 510 9880618 #558 | *E* acabrera@ciq.com  | *W* ciq.com



On Mon, Feb 3, 2025 at 3:41 PM Sam James <sam@gentoo.org> wrote:

> Arian Cabrera <acabrera@ciq.com> writes:
>
> > To whom it may concern,
> >
> > I wanted to raise a question, regarding binutils-devel shipping
> libiberty library with deprecated functions (sys_nerr,
> > sys_errlist) causing the following errors in Rocky Linux versions using
> glibbc 2.32 and up.
>
> Note that libiberty isn't really supposed to be a public library at all,
> it's really intended to be used statically linked within a project like
> binutils or gcc.
>
> >
> > Why the following doesn't work, if binutils ships liberty specifically
> for this? Correct?
> > Any workaround? If the workaround is to change code and move away from
> using liberty, could you please explain the reason
> > why?
>
> I suspect it's because the libiberty config.h isn't being included so it
> doesn't know it needs to define the fallbacks.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-03 20:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-03 15:27 Rocky Linux sys_nerr, sys_errlist deprecation Arian Cabrera
2025-02-03 20:41 ` Sam James
2025-02-03 20:49   ` Arian Cabrera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).