Bug 27150 - alpha: wait4() is unavailable in static linking
Summary: alpha: wait4() is unavailable in static linking
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.33
Assignee: Adhemerval Zanella
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-05 07:47 UTC by Sergei Trofimovich
Modified: 2021-01-05 18:01 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich 2021-01-05 07:47:29 UTC
Originally reported as https://bugs.gentoo.org/763618 by Yoshihiko Iwama where static linking of a binary for initramfs fails on alpha:

```c
$ cat a.c
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>

int main() {
    pid_t pid = 1;
    int wstatus;
    int options;
    struct rusage ru;
    return wait4(pid, &wstatus, options, &ru);
}
$ alpha-unknown-linux-gnu-gcc a.c -o a
$ LANG=C alpha-unknown-linux-gnu-gcc a.c -o a -static
/usr/libexec/gcc/alpha-unknown-linux-gnu/ld: /tmp/cciRui2f.o: in function `main':
(.text+0x40): undefined reference to `wait4'
collect2: error: ld returned 1 exit status
```

The suspect is https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=09153638cfef9166586b0c21e852ea0d6f15a0fd that misses static library handling.
Comment 1 Adhemerval Zanella 2021-01-05 14:30:22 UTC
Fixed on 2.33.
Comment 2 Sergei Trofimovich 2021-01-05 18:01:20 UTC
Thank you! Linking patch here for posterity: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=6cc992412cd8c8555ca5d67fa2b994e38ccb6c1f