Bug 486545 - ppc64 gcc-4.4 emits .eh_frame compiling kernel modules
ppc64 gcc-4.4 emits .eh_frame compiling kernel modules
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
powerpc Linux
low Severity high
: ---
: ---
Assigned To: Kernel Maintainer List
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-02-20 03:47 EST by Kazunori Asayama
Modified: 2009-03-25 00:32 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-03-25 00:32:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Kazunori Asayama 2009-02-20 03:47:43 EST
Description of problem:

The kernel in rawhide installer image for PowerPC fails in loading kernel modules because of the error 'Unknown ADD relocation: 26'.

Version-Release number of selected component (if applicable):


How reproducible:

  Every time.

Steps to Reproduce:
1. Insert rawhide's boot disc (boot.iso) into target machine.
   (I tried on PLAYSTATION 3).
2. Choose language.
3. Choose keyboard type.
4. Choose installation method (I tried 'NFS directory').

Actual results:

Unexpected 'No driver found' dialog is displayed. If switching to tty4 by ALT+F4, it shows kernel's error messages:

  <4>spufs: Unknown ADD relocation: 26
  <4>ps3stor_lib: Unknown ADD relocation: 26
  <4>ps3rom: Unknown ADD relocation: 26
  <4>usb_stoage: Unknown ADD relocation: 26

Expected results:

  The kernel modules are properly loaded.

Additional info:
Comment 1 Kazunori Asayama 2009-02-22 22:43:40 EST
I tried upstream kernel 2.6.29-rc5-git7:

  * Built by gcc-4.4.0-0.20.ppc (rawhide): same error
  * Built by gcc-4.3.2-7.pcc (Fedora 10): OK

So I guess:

  * gcc 4.4 generates relocation type R_PPC64_REL32 (== 26) for modules.
  * gcc 4.3 doesn't.
  * the current kernel doesn't support R_PPC64_REL32 (yet).
Comment 2 Kazunori Asayama 2009-02-23 01:49:23 EST
According to readelf -rSW "module", it looks like the .eh_frame section causes the problem. R_PPC64_REL32 relocations are generated only in .rela.eh_frame section, and only gcc 4.4 emits the .rela.eh_frame and .eh_frame.
Comment 3 Josh Boyer 2009-02-23 13:17:07 EST
I see similar (but less descriptive) errors loading modules with my G5 now that the prom_init.o gcc bug is fixed.

Comment 4 Kyle McMartin 2009-02-23 14:17:24 EST
Hi, this isn't really my area, but looking at binutils and glibc's dl-machine files, it looks like this is just a simple pcrel fixup.

I've started a testbuild here, no promises it doesn't accidently fixup the pc to point to panic() or explode some kittens or something.

Comment 5 Roland McGrath 2009-02-23 20:48:34 EST
gcc-4.4.0-0.21.ppc running under -m64 seems to default to emitting .eh_frame info.  This is a change from 4.3/f10 and affects building kernel modules.  We did not find a combination of -fno-asynchronous-unwind-tables et al that turned it off.  Defaulting to on is OK if there is a consistent way to disable it that we can use in the kernel makefiles.
Comment 6 Alexandre Oliva 2009-02-23 23:58:02 EST
Does -fno-dwarf2-cfi-asm avoid the creation of this section?  This is enabled by default if the assembler supports .cfi* directives and debug information is requested, and causes the assembler to emit .eh_frame sections, even if the compiler itself doesn't.

If that doesn't fix it, would you please get me a simple preprocessed testcase and command line that triggers the creation of such a section, so that I can duplicate the problem without having to figure out how to get a kernel build to use a locally-built compiler.  (I don't have easy access to ppc rawhide boxes).  Thanks,
Comment 7 Alexandre Oliva 2009-02-24 01:19:57 EST
FTR, I've just finished building recent binutils and gcc on the ppc box I've got access to.  I verified that compiling a trivial 'main(){}' program with -O2 -g creates an object file with a .eh_frame section, and that adding -fno-dwarf2-cfi-asm to the command line creates an object file without this section.  I suggest the Linux build machinery to use this option when GCC offers it.  I'm pretty sure there's support in the Linux build machinery to use options only when they're available.
Comment 8 Kyle McMartin 2009-02-24 01:50:32 EST
Thanks Alexandre, I've cooked a patch and will CC you when I send it in. It'll go into the next release of the rawhide kernel as well.

regards, Kyle
Comment 9 Kyle McMartin 2009-02-24 14:29:34 EST

The patch should be in this kernel,

Josh Boyer has confirmed it fixes things on his powerpc, could I ask that you give it a try as well?

Comment 10 Kazunori Asayama 2009-02-25 02:47:55 EST
I confirmed my problem was fixed in 2.6.29-0.147.rc6.fc11 on PS3.
Comment 11 Chuck Ebbert 2009-03-25 00:32:36 EDT
Patch went into 2.6.29 upstream too.

Note You need to log in before you can comment on or make changes to this bug.