Mail Archives: djgpp/2017/01/31/10:00:09
On Tuesday, January 31, 2017 at 4:54:20 PM UTC+3, Louis Santillan (lpsantil AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
> Can you replace CFLAGS/LDFLAGS to exclude the `--gc-sections`?
>
> On Tue, Jan 31, 2017 at 2:48 AM, multisosnooley AT gmail DOT com [via
> djgpp AT delorie DOT com] <djgpp AT delorie DOT com> wrote:
> > On Thursday, January 26, 2017 at 3:13:00 AM UTC+3, multiso DOT DOT DOT AT gmail DOT com wrote:
> >> On Wednesday, January 25, 2017 at 6:19:02 PM UTC+3, Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
> >> > On 1/25/17, multisosnooley AT gmail DOT com [via djgpp AT delorie DOT com]
> >> > <djgpp AT delorie DOT com> wrote:
> >> > > On Wednesday, January 25, 2017 at 3:07:30 PM UTC+3, Ozkan Sezer
> >> > > (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
> >> > >> On 1/25/17, multisosnooley AT gmail DOT com [via djgpp AT delorie DOT com]
> >> > >> <djgpp AT delorie DOT com> wrote:
> >> > >> > Hi!
> >> > >> >
> >> > >> > We have a problem with building micropython with djgpp with
> >> > >> > '--gc-sections'
> >> > >> > flag active. It segfaults on linking.
> >> > >> > More info:
> >> > >> > https://github.com/micropython/micropython/issues/2560
> >> > >> > https://github.com/micropython/micropython/pull/2644
> >> > >> >
> >> > >>
> >> > >> Possibly related to this?
> >> > >> https://sourceware.org/bugzilla/show_bug.cgi?id=20401
> >> > >>
> >> > >> Which binutils version are you using?
> >> > >
> >> > > I don't exactly now which version of binutils was used in previous cases,
> >> > > but right now newest available is
> >> > > http://www.delorie.com/pub/djgpp/deleted/v2gnu/bnu226sr3.zip and in bug you
> >> > > reference fix comes in 2.27, but it is not released yet. Or?
> >> > >
> >> >
> >> > There is a djgpp port of 2.27:
> >> > http://www.delorie.com/pub/djgpp/current/v2gnu/bnu227s.zip
> >> > http://www.delorie.com/pub/djgpp/current/v2gnu/bnu227b.zip
> >> > Besides, the fix is (should be) applicable to 2.26 too.
> >> >
> >> > Looking at the links you provided:
> >> > https://github.com/micropython/micropython/issues/2560#issuecomment-260157891
> >> > mentions binutils 2.20.1.20100303: if that is version giving you the
> >> > segfault then I don't know, because but as far as I remember the
> >> > --gc-sections support for coff and pe targets began with
> >> > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0f088b2a
> >> > and that corresponds to either 2.25.1 or 2.26
> >>
> >> Just tested:
> >>
> >> [poh ~/tmp/upython]$ cat test.c
> >> int main () { return 0; }
> >> [poh ~/tmp/upython]$ djgpp-6.2.0/bin/i586-pc-msdosdjgpp-gcc -Wl,--gc-sections test.c
> >> collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped
> >> compilation terminated.
> >> [poh ~/tmp/upython]$ djgpp-6.2.0/bin/i586-pc-msdosdjgpp-gcc --version
> >> i586-pc-msdosdjgpp-gcc (GCC) 6.2.0
> >> Copyright (C) 2016 Free Software Foundation, Inc.
> >> This is free software; see the source for copying conditions. There is NO
> >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> >>
> >> [poh ~/tmp/upython]$ djgpp-6.2.0/bin/i586-pc-msdosdjgpp-ld --version
> >> GNU ld (GNU Binutils) 2.26.20160125
> >> Copyright (C) 2015 Free Software Foundation, Inc.
> >> This program is free software; you may redistribute it under the terms of
> >> the GNU General Public License version 3 or (at your option) a later version.
> >> This program has absolutely no warranty.
> >>
> >> Will try to test with 2.27
> >
> > Unfortunately, building djgpp with 2.27s failed with:
> > ../bfd/.libs/libbfd.a(coff-go32.o): In function `coff_swap_scnhdr_in':
> > /home/broomrider/tmp/upython/build-djgpp/build/bnu227s/gnu/binutils-2.27/bfd/coffswap.h:775: undefined reference to `coff_64k_relocation_enabled'
> > ../bfd/.libs/libbfd.a(coff-go32.o): In function `coff_swap_scnhdr_out':
> > /home/broomrider/tmp/upython/build-djgpp/build/bnu227s/gnu/binutils-2.27/bfd/coffswap.h:815: undefined reference to `coff_64k_relocation_enabled'
> > ../bfd/.libs/libbfd.a(coff-go32.o): In function `coff_set_alignment_hook':
> > /home/broomrider/tmp/upython/build-djgpp/build/bnu227s/gnu/binutils-2.27/bfd/coffcode.h:1990: undefined reference to `coff_64k_relocation_enabled'
> > ../bfd/.libs/libbfd.a(coff-stgo32.o): In function `_bfd_go32_mkobject':
> > /home/broomrider/tmp/upython/build-djgpp/build/bnu227s/gnu/binutils-2.27/bfd/coff-stgo32.c:454: undefined reference to `coff_64k_relocation_enabled'
> >
> > I found this:
> > https://groups.google.com/d/msg/comp.os.msdos.djgpp/mUOzbTpE1Sk/ODqAENwlAgAJ
> > But, as I realized, there is no solution right now.
You mean for test code? If I omit `--gc-sections` everything work as expected. The question is exactly about `--gc-sections` and why linker crashes. Probably binutils 2.27 will solve the problem, but I can't build it.
- Raw text -