NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-hppa/56876: hppa: "cc -pg" fails with "undefined reference to `mprotect'"
>Number: 56876
>Category: port-hppa
>Synopsis: hppa: "cc -pg" fails with "undefined reference to `mprotect'"
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-hppa-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 10 22:10:00 +0000 2022
>Originator: Tom Lane
>Release: HEAD/202206081310Z
>Organization:
PostgreSQL Global Development Group
>Environment:
NetBSD sss2.sss.pgh.pa.us 9.99.97 NetBSD 9.99.97 (SD0) #3: Thu Jun 9 15:19:02 EDT 2022 tgl%nuc1.sss.pgh.pa.us@localhost:/home/tgl/netbsd-H-202206081310Z/obj.hppa/sys/arch/hppa/compile/SD0 hppa
>Description:
Eyeing the (gratifyingly short) list of remaining /usr/tests failures on HPPA, I notice that half a dozen of them boil down to "the -pg switch doesn't work". You get a link failure complaining about mprotect(). I can't find any evidence that mprotect() is treated any differently on HPPA than any other arch, so I'm pretty mystified by this.
>How-To-Repeat:
$ cat hello.c
#include <stdio.h>
#include <stdlib.h>
int main(void) {printf("hello world\n");exit(0);}
$ cc -pg hello.c
ld: /usr/lib/libgcc_s.so: undefined reference to `mprotect'
Interestingly, if the program to be compiled itself references mprotect(), all is well:
$ cat mpro.c
#include <sys/mman.h>
int main(int argc, char **argv)
{
return mprotect(argv[0], 100, PROT_READ);
}
$ cc -pg mpro.c
$
>Fix:
Given the observation that a program-supplied mprotect reference fixes it, I suspect that there's some HPPA-specific problem in the rules for when to pull in an --as-needed library. I have little idea where to look though.
Home |
Main Index |
Thread Index |
Old Index