Bug 3193

Summary: Need to use CFI_ wrappers to build NPTL with gcc 4.2.1/binutils 2.17
Product: uClibc Reporter: Rob Landley <rob>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: enhancement CC: uclibc-cvs
Priority: P5    
Version: 0.9.32   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Rob Landley 2011-02-02 20:54:27 UTC
Pthreads builds fine, NPTL does not.  Mailing list thread starts here:

http://lists.uclibc.org/pipermail/uclibc/2011-January/044684.html
Comment 1 Carmelo Amoroso 2011-02-07 15:06:07 UTC
Hi Rob,
I've checked it further and both .cfi_personality and .cfi_lsda are already wrapped by the corresponding macros.

The problem is that, by default, on i386 the macro __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ is defined (see the __uClibc_arch_features.h), to the corresponding macro HAVE_ASM_CFI_DIRECTIVES is also enabled.

As a temporary w/a you should just #undef it.

As a general fix, I'd suggest to have an config option __UCLIBC_USE_ASM_CFI_DIRECTIVES__ that the user can enable/disable has he likes,

libc-symbols shoudl do something like this:

#if defined __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ && defined __UCLIBC_USE_ASM_CFI_DIRECTIVES__

#define HAVE_ASM_CFI_DIRECTIVES
#else
#undef HAVE_ASM_CFI_DIRECTIVES
#endif

It is similar to ARCH_HAS_MMU and ARCH_USE_MMU.

Comments ?

Cheers,
Carmelo
Comment 2 Carmelo Amoroso 2011-02-07 15:09:44 UTC
Indeed, the only cfi pseudo ops that are currently not wrapped are .cfi_sections.
I had a problem with working on ARM (I've discusses this with Khem, and we agreed that a wrapper would be useful too).

Even if in this case the support for the .cfi_sections is present starting from some version of binutils.

So likely in this case a build-time check should be done, to selectively disable
only the unsupported cfi pseudo-ops... but this is questionable.
Comment 3 Carmelo Amoroso 2011-02-09 11:46:40 UTC
Rob ? any comments ?
Comment 4 Bernhard Reutner-Fischer 2011-02-09 17:45:20 UTC
We have a GCC_PREREQ() macro, but this does of course not handle the assembler and you could in theory run gcc-old with a binutils-new so this is not a real option.
So we really need to use some assembler macro to be on the safe side..

Rob, can you put some sed to turn off CFI in your build scripts?
Comment 5 Rob Landley 2011-02-09 20:10:30 UTC
I tried disabling it back in January.  Nobody replied:

  http://lists.uclibc.org/pipermail/uclibc/2011-January/044701.html

Various architectures then complained that -mfdpic was an unknown option.
Comment 6 Bernhard Reutner-Fischer 2011-02-09 20:30:17 UTC
yea, because I usually stop reading when i encounter
"My buildall.sh script builds"...

So, if your toolchain doesn't do fdpic you either configured it wrong or are using the wrong target file format or both, no?
Comment 7 Rob Landley 2011-02-09 21:27:01 UTC
Or it could mean I'm not building for the FRV processor, since it is an option the man page only lists under "FRV options":

http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2009-06/msg01753.html
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2009-06/msg01756.html
Comment 8 Carmelo Amoroso 2011-03-03 08:18:44 UTC
I've committed a patch to cover the missing CFI macros (cfi_sections).

Arch that do not want to use CFI, just need to undef the __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__.

I think it can be closed.