Skip to content

BFD unhappy about a shared library build with -z pack-relative-relocs #1817

@marxin

Description

@marxin

Started with 14fdad2 where my gentoo docker testing stopped working for ncurses package (/usr/lib64/libreadline.so.8.3 comes from the package). If I build the package, and then try using it with BFD, it complains with:

$ cat /tmp/tinfo.c
#include <stdio.h>
#include <term.h>
#include <curses.h>

int main(void) {
    int err = 0;

    if (setupterm(NULL, 1, &err) != OK) {
        fprintf(stderr, "setupterm failed, err=%d\n", err);
        return 1;
    }

    int cols = tigetnum("cols");
    printf("Terminal columns: %d\n", cols);

    return 0;
}
$ cp /usr/sbin/*-pc-linux-gnu-ld.bfd /usr/sbin/ld && gcc /tmp/tinfo.c -ltinfo && ./a.out
/usr/x86_64-pc-linux-gnu/binutils-bin/2.46.0/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../lib64/libtinfo.so: undefined reference to `GLIBC_ABI_DT_RELR@GLIBC_ABI_DT_RELR'
collect2: error: ld returned 1 exit status
$ readelf -sW /usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../lib64/libtinfo.so | grep ABI_DT
    24: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND GLIBC_ABI_DT_RELR@GLIBC_ABI_DT_RELR (12)

while the same snippet runs correctly if linked by Wild:

$ cargo b -r && cp target/release/wild /usr/sbin/ld
$ gcc /tmp/tinfo.c -ltinfo && ./a.out
Terminal columns: 163

@mati865 can you please take a look? Do you have enough information for the reproducer?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions