controlling default gcc output

58 views
Skip to first unread message

Mike Frysinger

unread,
Dec 6, 2011, 11:34:14 PM12/6/11
to x32...@googlegroups.com
looks like the x86 gcc port can be configured to default to 32bit
output, or 64bit output. but there isn't an option to default to x32.
could we get a flag for this ?
-mike

H.J. Lu

unread,
Dec 7, 2011, 12:14:44 AM12/7/11
to x32...@googlegroups.com


Funny you asked. Does this commit

http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0a85c487b7174b1d24fd794a4b18ccdca0eb9165

work for you? It is on hjl/x32/mx32 branch. You can try to
backport it to gcc 4.6.


--
H.J.

Mike Frysinger

unread,
Dec 7, 2011, 12:19:31 AM12/7/11
to x32...@googlegroups.com
On Wed, Dec 7, 2011 at 00:14, H.J. Lu <hjl....@gmail.com> wrote:
> On Tue, Dec 6, 2011 at 8:34 PM, Mike Frysinger <vap...@gmail.com> wrote:
>> looks like the x86 gcc port can be configured to default to 32bit
>> output, or 64bit output.  but there isn't an option to default to x32.
>>  could we get a flag for this ?
>
> Funny you asked.  Does this commit
>
> http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0a85c487b7174b1d24fd794a4b18ccdca0eb9165
>
> work for you?  It is on hjl/x32/mx32 branch.  You can try to
> backport it to gcc 4.6.

looks like it should. i'll give it a spin.

note, arm/mips seems to use --with-abi= to select the default abi ...
would be nice if we stayed consistent ...
-mike

H.J. Lu

unread,
Dec 7, 2011, 1:34:57 PM12/7/11
to x32...@googlegroups.com

I changed hjl/x32/mx32 branch to use --with-abi instead.

Thanks.

--
H.J.

H.J. Lu

unread,
Dec 7, 2011, 1:51:31 PM12/7/11
to x32...@googlegroups.com

I also backported it to hjl/x32/gcc-4_6-branch+mx32 branch.

--
H.J.

Mike Frysinger

unread,
Dec 7, 2011, 3:26:02 PM12/7/11
to x32...@googlegroups.com

nice. i don't suppose we could also have --with-abi take the same
argument style as --with-multilib-list ? it's a bit awkward to use
"m64 m32 mx32" for --with-multilib-list, but --with-abi takes "64 32
x32".
-mike

H.J. Lu

unread,
Dec 7, 2011, 3:47:53 PM12/7/11
to x32...@googlegroups.com

--with-abi for other targets doesn't have "m".

--
H.J.

Mike Frysinger

unread,
Dec 7, 2011, 3:56:02 PM12/7/11
to x32...@googlegroups.com

true, but there aren't any ports atm that accept both --with-abi and
--with-multilib-list which we can refer to for precedence :). can we
have --with-abi accept both forms to keep things simple for the
package maintainers (i.e. me) ?

+ case ${with_abi} in
+ ""|32|m32)
+ ....
+ 64|m64)
+ ....
+ x32|mx32)
+ ....

this allows code doing multilib mapping to be written once rather than
needing one chunk for --with-multilib-list, and then mostly
duplicating it for --with-abi ...
-mike

H.J. Lu

unread,
Dec 7, 2011, 4:32:02 PM12/7/11
to x32...@googlegroups.com

Done on both hjl/x32/mx32 and hjl/x32/gcc-4_6-branch+mx32 branches.

--
H.J.

Mike Frysinger

unread,
Dec 7, 2011, 5:03:02 PM12/7/11
to x32...@googlegroups.com

this one ICEs for me with binutils-2.22 and glibc-2.14.1 when using
--with-abi :(. omitting --with-abi (so that the default is the
standard x86-64 output) works.

using 49e5ed49c41a142e0ec6788d1af2d04ece0187fb, see the failure below:

CFLAGS='-O2 -pipe' \
CXXFLAGS='-O2 -pipe' \
../configure \
--prefix=/usr \
--host=x86_64-pc-linux-gnu \
--build=x86_64-pc-linux-gnu \
--without-ppl \
--without-cloog \
--with-system-zlib \
--disable-lto \
--disable-nls \
--disable-werror \
--disable-libmudflap \
--disable-libssp \
--disable-libgomp \
--disable-libgcj \
--disable-libquadmath \
--enable-checking=release \
--enable-languages=c \
--enable-multilib \
--with-multilib-list=m64,m32,mx32 \
--with-abi=x32 \
--enable-shared \
--enable-threads=posix \
--enable-__cxa_atexit \
--enable-clocale=gnu
make bootstrap-lean -j4

/usr/local/src/gnu/gcc/git/build/./prev-gcc/xgcc
-B/usr/local/src/gnu/gcc/git/build/./prev-gcc/
-B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/bin/
-B/usr/x86_64-pc-linux-gnu/lib/ -isystem
/usr/x86_64-pc-linux-gnu/include -isystem
/usr/x86_64-pc-linux-gnu/sys-include -I../../libcpp -I.
-I../../libcpp/../include -I../../libcpp/include -g -O2 -gtoggle -W
-Wall -Wwrite-strings -Wmissing-format-attribute -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -Wc++-compat -pedantic
-Wno-long-long -I../../libcpp -I. -I../../libcpp/../include
-I../../libcpp/include -c -o lex.o -MT lex.o -MMD -MP -MF
.deps/lex.Tpo ../../libcpp/lex.c
../../libcpp/lex.c: In function 'search_line_sse42':
../../libcpp/lex.c:438:4: internal compiler error: in
copy_to_mode_reg, at explow.c:635
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [lex.o] Error 1
make[3]: Leaving directory `/usr/local/src/gnu/gcc/git/build/libcpp'
-mike

Mike Frysinger

unread,
Dec 8, 2011, 1:13:35 PM12/8/11
to x32...@googlegroups.com
On Wed, Dec 7, 2011 at 17:03, Mike Frysinger <vap...@gmail.com> wrote:
> this one ICEs for me with binutils-2.22 and glibc-2.14.1 when using
> --with-abi :(.  omitting --with-abi (so that the default is the
> standard x86-64 output) works.
>
> using 49e5ed49c41a142e0ec6788d1af2d04ece0187fb, see the failure below:

just to follow up ... i talked to hjlu privately to post preprocessed
files/etc..., and he committed a fix to address this: "Properly handle
-m32, -m64 and -mx32 with target optimization". seems to be working
for me (gcc-4.7 mainline and gcc-4.6 backport).
-mike

H.J. Lu

unread,
Dec 12, 2011, 5:46:01 PM12/12/11
to x32...@googlegroups.com

I checked a patch into both hjl/x32/mx32 and hjl/x32/gcc-4_6-branch+mx32
branches so that you can configure gcc with

--disable-multilib --with-abi=mx32

to only enable x32 run-time libraries and install them under /lib.


--
H.J.

Reply all
Reply to author
Forward
0 new messages