[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    [Pcc] PCC compiling on Ubuntu 22.04
From:       arnold () skeeve ! com
Date:       2023-06-14 22:58:18
Message-ID: 202306142258.35EMwQPI005828 () freefriends ! org
[Download RAW message or body]

Hi.

In some additional testing of current PCC on Ubuntu 22.04, I found there
is a problem with programs that call atexit():

$ cat foo.c
#include <stdio.h>
#include <stdlib.h>

void foo() { printf("foo called\n"); }

int main()
{
	atexit(foo);
	printf("in main()\n");
	return 0;
}

$ pcc foo.c -o foo
ld: /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS): in function `atexit':
(.text+0x7): undefined reference to `__dso_handle'
ld: foo: hidden symbol `__dso_handle' isn't defined
ld: final link failed: bad value
error: ld terminated with status 1

The missing object is for calling global C++ destructors. It's
enough to have

	int __dso_handle = 0;

in one's C code to get it to link.  PCC's configure needs to check
if this is necessary and generate this symbol if so.... (Yeah, more
GNU bloat or whatever. Not my fault.)

Thanks,

Arnold
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic