Issue Details (XML | Word | Printable)

Key: PCC-205
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: andre f.
Votes: 0
Watchers: 0
Operations

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

inline functions get external refs

Created: 06/Dec/10 09:56 AM   Updated: 18/Dec/10 05:13 PM
Component/s: Common code
Affects Version/s: None
Fix Version/s: None

Environment:
pcc 101205 on OpenBSD 4.7 amd64 compiling OpenBSD 4.7 kernel source (GENERIC kernel config)


 Description  « Hide
first a big thankyou for fixing all the bugs during the last week - that was really fast - thanks a lot !!!

the good news is - the 4.7 OpenBSD kernel source compiles now with pcc-101205 on both amd64 and i386
but now i get undefined references from the linker:

i915_irq.o(.text+0x4f9): In function `i915_user_irq_get':
: undefined reference to `i915_enable_irq'
i915_irq.o(.text+0x53d): In function `i915_user_irq_put':
: undefined reference to `i915_disable_irq'

the reduced code fragment triggering the error: (i removed inline from the 1st function to show the difference)
---
void i915_enable_irq();
void i915_disable_irq();

void i915_enable_irq()
{
}

inline void i915_disable_irq()
{
}

void i915_user_irq_get()
{
i915_enable_irq();
}

void i915_user_irq_put()
{
i915_disable_irq();
}
---

nm for gcc compiled object:
0000000000000010 T i915_disable_irq
0000000000000000 T i915_enable_irq
0000000000000020 T i915_user_irq_get
0000000000000030 T i915_user_irq_put

nm for pcc compiled object:
                                 U i915_disable_irq
0000000000000000 T i915_enable_irq
0000000000000008 T i915_user_irq_get
0000000000000018 T i915_user_irq_put






 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 18/Dec/10 05:13 PM
This is because OpenBSD relies on the old non-C99-compatible inline syntax. In C99 a function having only the "inline" keyword should never ever generate external linkage. This in the behavior gcc also has in newer versions and using the -std=c99 flag.
Pcc follows C99 strictly but obeys the use of the gcc attribute gnu_inline to get the old gcc behavior.