[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#915194: gcc-8-cross: mips64el-linux-gnuabi64-gcc-8 munmap_chunk(): invalid pointer when build for o32



YunQiang Su <wzssyqa@gmail.com> 于2019年12月24日周二 下午8:57写道:
>
> YunQiang Su <wzssyqa@gmail.com> 于2018年12月2日周日 上午1:46写道:
> >
> > On Sun, 2 Dec 2018 00:30:21 +0800 YunQiang Su <wzssyqa@gmail.com> wrote:
> > > Package: src:gcc-8-cross
> > > Version: 23
> > >
> > > These bellow cmd will show:
> > >   munmap_chunk(): invalid pointer
> > >   Aborted
> > >
>
> I know what's the problem of this patch:
>
> prefix_info.name = (const char *) prefixed_name;
>
> this line change the address of prefix_info.name on fly,
> and when the compile process finish, it will try to be free,
> and then this problem happens.
>
> I have no clear idea about how to fix it yet.

https://salsa.debian.org/toolchain-team/gcc/blob/master/debian/patches/gcc-search-prefixed-as-ld.diff#L9
This problem is due to `path` has no enough space.

The privious version patch is
    len +=  strlen (multiarch_suffix) + 2
while multiarch_suffix value for
    mips64el-linux-gnuabi64-gcc-9 -mabi=32
it may be
   mipsel-linux-gnu/9/
it is not enough.

Currently it is
   len += strlen (DEFAULT_REAL_TARGET_MACHINE) + 2;
Which will make problem for
   mipsel-linux-gnu-gcc-9 -mabi=64

the correct way should be:

len += MAX (strlen(DEFAULT_REAL_TARGET_MACHINE), multiarch_len) + 2;

>
> >
> > And an new discovery: i386 version don't have problem...,
> > aka only amd64 version has problem.
> >
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -c -mabi=32 -xc -
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -B
> > > /non_exists/ -c -mabi=32 -xc -
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -B
> > > /usr/share -c -mabi=32 -xc -
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -EB -c
> > > -mabi=32 -xc -
> > >
> > >
> > > Some other example that work well
> > >
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -c -mabi=n32 -xc -
> > > $  # works well, use abi=n32
> > >
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -c -mabi=64 -xc -
> > > $  # works well, use abi=64
> > >
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -B
> > > /usr/mips64el-linux-gnuabi64/bin/ -c -mabi=32 -xc -
> > > $ # works well, add -B option
> > >
> > > $ echo "int a(){ return 1; }" | mips64el-linux-gnuabi64-gcc-8 -B
> > > /usr/bin/ -c -mabi=32 -xc -
> > > $ # works well,  add -B option
> > >
> > > $ echo "int a(){ return 1; }" | mips64-linux-gnuabi64-gcc-8 -c -mabi=32 -xc -
> > > $ # works well,  add  use mips64 aka eb
> > >
> > > $ echo "int a(){ return 1; }" | mips64-linux-gnuabi64-gcc-8  -EL -c
> > > -mabi=32 -xc -
> > > $ # works well,  add  use mips64 aka eb, and with -EL option.
> > >
> > > Is it an upstream bug?
> > >
> > > --
> > > YunQiang Su
> > >
> > >
>
>
>
> --
> YunQiang Su



-- 
YunQiang Su


Reply to: