Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 59082 - biew-5.6.1 needs filter-flags -fPIC
Summary: biew-5.6.1 needs filter-flags -fPIC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High major (vote)
Assignee: Michal Januszewski (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-01 11:03 UTC by Cory Visi (RETIRED)
Modified: 2004-08-02 17:14 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
biew-5.6.1.ebuild.patch (biew-5.6.1.ebuild.patch,965 bytes, patch)
2004-08-01 11:04 UTC, Cory Visi (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cory Visi (RETIRED) gentoo-dev 2004-08-01 11:03:24 UTC
Michal, you are probably familiar with this compile error already:

biewlib/sysdep/ia32/cpu_info.c:166: error: can't find a register in class `BREG' while reloading `asm'

This is caused by the -fPIC flag being specified for gcc. Your check for hardened gcc is no longer valid (hardened changed its gcc version string), nor do I recommend doing it that way. The best way is to simply use "filter-flags" to filter out -fPIC.

I'v attached an ebuild patch to fix the problem, but I'm also going to pursue fixing the actual code to compile with -fPIC.

Let me know if this is helpful.
Comment 1 Cory Visi (RETIRED) gentoo-dev 2004-08-01 11:04:28 UTC
Created attachment 36591 [details, diff]
biew-5.6.1.ebuild.patch
Comment 2 Michal Januszewski (RETIRED) gentoo-dev 2004-08-02 11:12:42 UTC
Thanks for the patch :) I'm taking your word that it solves the problem as I don't really feel like recompiling gcc with 'hardened' USE flag just to try it out ;) It certainly is a much nicer solution that just saying "Ermm.. We're sorry, but this thing will not work on your system." which is what we've been doing with biew till now.
Comment 3 Cory Visi (RETIRED) gentoo-dev 2004-08-02 17:14:17 UTC
Ok, I reached a turning point in my research on this package, and I just wanted to report my findings attached to this bug.

biew cannot compile, as is, with the -fPIC flag because of two functions:
__cpuid_ebxecx() in biewlib/sysdep/ia32/cpu_info.c
__Xlat__() in biewlib/sysdep/ia32/_inlines.h

Both functions use inline assembly which makes use of the ebx register (for output in both cases). On x86, PIC uses the ebx register, so this causes a problem when the inline assembly itself uses ebx.

In __cpuid_ebxecx(), the cpuid system call actually returns information in the ebx register that biew uses, so I am unable to find a work-around.

In __Xlat__(), the xlatb assembly instruction (also sometimes called xlat) returns a result in the ebx register. I was unable to find an alternative table lookup assembly function that uses a different register and thus, unable to find a work-around.

I should also note that on other architectures, such as amd64 and mips, which require PIC, the ebx register is not used, so this code does not have the same problem. However, the assembly code for biew is all x86, so it would not work anyway.


A possible solution might be to report the output from the functions above in a register other than ebx, and declare ebx as clobbered, but I am not sure this is good enough. I will find out!