X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ULhgkuJk98u+yes3M7NtJu0/3lf+wlf8aX/ptwt6VRE=; b=lprDoSKi46GT/wa6DhvCYiWORKGwG5cHbf6yXItuC4HQ0eyVJ4tQQM0W+mPUdYhJjQ s8xxusheUOBG76hMKo7GbMNO6DWejlO0ZM7QGIACRhGxfgWkJe/QvCeIoCl+dZPYKdJ9 tyom/emmERTAk3tT4mATRqyJWNpKsVCTE33pIORLQ7zWZt5GQuwLcN6hnymEok8a8jKI Agf2qmyzwXUJw/ebML9eSeSQaBHtgpiE4l8AF5QFe87pF+HUdaAfw264+GSkZhM6M4m7 uBUVVGly/MBSSRRvRQxt5SUf3MxORo0kGqASXybw2V4B+KnOJ41tQqDgDSqvgtgGhGJq 5qpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ULhgkuJk98u+yes3M7NtJu0/3lf+wlf8aX/ptwt6VRE=; b=eJTRjBr0OvMzt5SeE4htLhVHhgg6oHir472prcs/jA6vLrW09aLfKHrIKrt7v2c1w0 O/FGT0ZrUxwiNYnXRKzQebROB9KHxb7dGhNdznoQYQevNHnAklMwaHfzDJIia6qp9tev +aMzy7AnQOpBqLprS3zyEEjeA1+P9or2e6R/Jw9R5KwZzuaU8iPvBYRsZS4mQ0IGGtm2 al9kFYICAPHCoB7TMIy3SQyxnw7jnR4CD1S4aFxutpkmNIQ5xTFllEWRMVszJ1JkZE16 acM/y70o8DsXpeRrbl4UcJgh8aLZ6/r/7vRcxfKuB1tlu4QGXaS4Sx3Wtjj3EhbLmDGp elNQ== X-Gm-Message-State: AGi0PuZC+wzGjS7u1JZwoUdh4p/0NqqNyTw7ma6JoJW0mGTh//IFCtKv d4Ni2R2TXfaLgsHpCFlcEf0= X-Google-Smtp-Source: APiQypIL+FIiDrf5CwIWUH5+P4ixtcytOozpz2im4IumZGo+HNPw/xNQ35ubB9Crdd1SSwVBiWWmqA== X-Received: by 2002:adf:e4cc:: with SMTP id v12mr9342990wrm.106.1589042914236; Sat, 09 May 2020 09:48:34 -0700 (PDT) Subject: Re: Changes to config/i386/djgpp.c To: djgpp AT delorie DOT com References: <65c420b7-835c-cba6-6ff6-22d530d513bf AT iki DOT fi> Cc: andris DOT pavenis AT iki DOT fi From: "J.W. Jagersma (jwjagersma AT gmail DOT com) [via djgpp AT delorie DOT com]" Message-ID: <11a24e98-68c6-bf28-87da-e1fadcefefef@gmail.com> Date: Sat, 9 May 2020 18:48:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 2020-05-09 18:28, Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com] wrote: > On 5/9/20 4:55 PM, J.W. Jagersma wrote: >> Hi Andris, >> Thanks for making gcc 10 available so quickly.  I updated my build >> scripts and applied my patch, but then ran into a problem: >> >>      i386-pc-msdosdjgpp-gcc -pipe ... -c symify.c >>      i386-pc-msdosdjgpp-ld -s  ../../../lib/crt0.o symify.o ../../../lib/libdbg.a ../../../lib/libc.a -o ../../../bin/symify.exe D:/msys64/usr/local/cross/lib/gcc/i386-pc-msdosdjgpp/10.1.0/libgcc.a -T ../../../lib/djgpp.djl >>      D:\msys64\usr\local\cross\bin\i386-pc-msdosdjgpp-ld.exe: ../../../lib/libc.a(stdiohk.o):stdiohk.c:(.data+0x0): multiple definition of `__stdio_cleanup_hook'; ../../../lib/libc.a(exit.o):exit.c:(.bss+0x8): first defined here >>      make[2]: *** [makefile:22: ../../../bin/symify.exe] Error 1 >>      make[1]: *** [makefile.sub:2: all_subs] Error 2 >>      make: *** [makefile:10: all] Error 2 >> >> At first I thought it was caused by my patch, since it looks like this >> symbol is placed in .bss in one compilation unit, and .data in another. >> However this problem didn't occur with gcc 9.  Inspecting the release >> notes for gcc 10, I found that gcc now links with -fno-common by >> default, so I think this needs to be fixed in libc now by declaring the >> symbol in exit.c with extern linkage: >> >>      extern void (*__stdio_cleanup_hook)(void); >> >> Or alternatively, libc needs to be compiled with -fcommon now. >> Did you run into this issue too?  How did you solve it? > > Known problem: > > int foo; > > int foo = 1; > > No more works with gcc-10. One must write instead: > > extern int foo; > > int foo = 1; > > Example how it can be fixed can be seen in ArchLinux AUR package which I updated yesterday: > > https://aur.archlinux.org/packages/djgpp-djcrx/ > > Problem is mentioned in https://gcc.gnu.org/gcc-10/changes.html > > The changes done for AUR package should perhaps be not committed to DJGPP CVS (no need to support old compilers for ArchLinux) > > Andris > > > PS. Sending also to djgpp mailing list as somebody else could be interested in that Thanks, I figured out a solution already: https://github.com/jwt27/djgpp-cvs/commit/9fcd924b8eec562eeacf53c92a18e06aacb48fa9.patch I think this is safe to commit to cvs, the -fcommon option is already mentioned in the manual for gcc 2.95.3, so it should be compatible even with ancient compiler versions.