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=20210112; h=message-id:date:mime-version:user-agent:content-language:to :references:from:subject:in-reply-to:content-transfer-encoding; bh=3lXAtZcP/JLmSX2uNEDaf0IuWpECGc6z5ijHlpLcRxo=; b=YPvT9F46fudlmGrjyn3ox9TV6y76WOdf/d5O+SJUGbudEO27+T+P6AFe8QoceqPq1G JJkBol34e1QHteqRZJb4TPDj6qtiMXDRP19M/eySwzNruuLznXOFs0SZvJGNA8UDn4Uk Kwb+RCXO+UD2BT3V3gnuc9sgF2NzkjU4vSZsKPihqfED50i9Y365XXeeAYNt7c024xSg /ITPnoDHArIKwJvXLuv0IHzY9H+AX6bla5PA9FqBZ8BxCQmNdX0WM/7zhudW0rb7v7gg bVyYf/SEElNurFrzWIHO8uXywMHhu+55nOzqmcI/EkY6ZA7dQa3BQwB+MaRQBgY7rwFt 4WpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:references:from:subject:in-reply-to :content-transfer-encoding; bh=3lXAtZcP/JLmSX2uNEDaf0IuWpECGc6z5ijHlpLcRxo=; b=o1vLorX9rKhixH0BPPwkZu6PWjfsowcSDWLd6D6Tiq73teT1z9XO78g/a9eODekts+ PhGsCdBG16yMRYM8aDOP9dZIH+Qafwa+uoORl7zVeCLG1hv5yx7Hl82Lk/Yosxofk/At pJKXjBfWFB6c2CbN0w1iEYXfOQnF5CebFgSDKOFXJny/bITj6o4XB8K/aEZxwd/CdsMa GWWenIcdr8ELTIPsazfhkuyr6GVRN6TyMuMp8eELemJHU1xuY2dKPjvQ3mCHHW9dcrfl uYvf9hATDNVtNmECCEKiBIVE02fKcskUTqkVgbnkIJwGntzSfxJz0RYAPsi0N2CRajSB vyAg== X-Gm-Message-State: AOAM531QhG6lpGLU9/75ScoN4dJfsmD/hw40HjqsXvuQPcffB6WkJELs 9y/G3x9XVYRLFkwD567HwTGgDOdakQU= X-Google-Smtp-Source: ABdhPJxMGEzasgeCn22aVC+Z08sTDMdAt//cf9cXuIyrd/yj3poL8tkCaN1ENlYcnnkf5WGepqmo1A== X-Received: by 2002:a17:907:ea0:: with SMTP id ho32mr19358527ejc.191.1636544667139; Wed, 10 Nov 2021 03:44:27 -0800 (PST) Message-ID: <1d9e4c7e-baef-bf45-3a05-f28b426f2f37@gmail.com> Date: Wed, 10 Nov 2021 12:44:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US To: djgpp AT delorie DOT com References: <4016e9cd-0be1-4758-8f29-db7770508ed6n AT googlegroups DOT com> <9788a12e-c532-b273-a13d-ae12d2eed8a7 AT gmail DOT com> <2239fa27-8162-ac1c-d7ac-12bf7443493e AT iki DOT fi> From: "J.W. Jagersma (jwjagersma AT gmail DOT com) [via djgpp AT delorie DOT com]" Subject: Re: DJGPP build of gcc-10.3.0 and make 4.3 incompatibility In-Reply-To: <2239fa27-8162-ac1c-d7ac-12bf7443493e@iki.fi> Content-Type: text/plain; charset=UTF-8; format=flowed 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 2021-11-09 17:43, Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com] wrote: > On 11/8/21 11:53, J.W. Jagersma (jwjagersma AT gmail DOT com) [via djgpp AT delorie DOT com] wrote: >> On 2021-11-03 15:43, Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com] wrote: >>> Actually gcc-10.3.0 was built for DJGPP, just not uploaded (both RPMs and DJGPP packages). Uploading could be easy. >> >> I've been waiting for djcross-gcc-10.3.0.tar.bz2, please do upload :) > > > File was already inside SRPM file so it was available. Just download size was big, Extracted and uploaded Thanks! >> >>> gcc-11 is a different story: >>> >>> - Ada library does not compile - alignment issues which are likely to cause problems also for other languages like (c or C++) when SSE or AVX is being used (and maybe even with earlier GCC versions) >> >> What sort of alignment issues?  I already ran into alignment trouble with SSE >> (at run-time, not compile-time).  To work around it, in the linker script I put >> SUBALIGN(0x10) on the .text and .bss sections.  For .data this is not possible >> because it leaves gaps in the ctors/dtors list, so I ended up linking >> *(.data .data.* .gnu.linkonce.d*) in .text.  A bit of a hack but .text is >> writable.  I suppose the input section alignment could be changed in binutils >> somewhere though. >> >> Also in libc I had to put attribute __attribute__((force_align_arg_pointer)) on >> __crt1_startup() to align the stack for ctors & main(). Alternatively this >> alignment could be performed manually in crt0.S. > > I was thinking about possible runtime alignment problems.I have not tested it myself. Ada library has some alignment checks and as far as I understand refuses to compile as max. available alignment is not sufficient (error message is not clear). I expect it would require 16-byte alignment as with SSE. GCC has also used 16-byte default stack alignment for a while now, amd64 ABI also enforces this. I'm curious to know how the Ada compiler detects it though. Currently in binutils only '.text' and '.data' are 16-byte aligned, as well as '.gnu.linkonce.{d,t,r}*', but not named sections such as '.text.unlikely', etc. If you compile with -ffunction-sections -fdata-sections then nothing will be aligned at all. Also '.bss*', '.gnu.linkonce.b*', '.const*' and '.rodata*' are only 4-byte aligned since there is no alignment entry defined for them. Following patch should fix all this without ldscript hacks. Stack alignment still needs to be done in libc of course, and I also noticed the ALIGN macro for malloc would need to be increased (nmalcdef.h:191). (I don't know if the .const entry here is necessary, the linker script uses it but gcc only seems to produce .rodata...) diff --git a/bfd/coff-go32.c b/bfd/coff-go32.c index d73c32b215d..3139ce07ac7 100644 --- a/bfd/coff-go32.c +++ b/bfd/coff-go32.c @@ -28,9 +28,15 @@ #define COFF_LONG_FILENAMES #define COFF_SECTION_ALIGNMENT_ENTRIES \ -{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".data"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ -{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".const"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".rodata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".bss"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.d"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ @@ -38,6 +44,8 @@ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.r"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.b"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \