Issue Details (XML | Word | Printable)

Key: PCC-428
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

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

section attribute conflicts with constructor

Created: 09/May/14 10:04 PM   Updated: 10/May/14 10:55 AM
Component/s: C frontend, i386 target
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
The 'constructor' and 'section' attributes have a conflicting effect. The following code example

void __attribute__((__section__(".text.startup"), __constructor__)) foo(void) { }

when compiled with "pcc -S foo.c" produces

        .section .text.startup,"ax",@progbits
        .align 4
        .globl foo
        .type foo,@function
foo:
        pushl %ebp
        movl %esp,%ebp
.L117:
.L119:
.L118:
        leave
        ret
        .size foo,.-foo
        .section .text.startup,"ax",@progbits
        .align 4
        .long foo
        .ident "PCC: pcc 1.1.0.DEVEL 20140509 for netbsd-i386"

without the section attribute, the reference is placed in the correct section '.ctors' with "aw" flags

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 10/May/14 10:55 AM
Fixed. Now con/destructors are set fixed so that special sections cannot iverride.