Issue Details (XML | Word | Printable)

Key: PCC-362
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

weak references not working right

Created: 25/Jun/11 03:11 PM   Updated: 25/Jun/11 04:12 PM
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
Weak references, via the __weakref__ attribute do not work correctly,
the example code

#include <stdio.h>

void my_foo(void) __attribute__((__weakref__("foo")));

int
main(int ac, char *av[])
{
    printf("my_foo %p\n", my_foo);

    if (my_foo != NULL)
        my_foo();

    return 0;
}

shows the problem, when compiled with pcc results in undefined references to "foo"
what should happen I think, is that the assembler output references "my_foo" and a

   .weakref my_foo,foo

line is emitted, this allows the linker to decide if foo can be resolved, or if it should
supply a nil value..

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 25/Jun/11 04:12 PM
weakref is not supported except for recent binutils. I have some support for it in pcc, but it should probably be checked in configure whether it exist or not.