Thanks LH_Mouse, I've tested the -malign-data option and it does the job.
Sadly for now I'm stuck with gcc 4.9.2 in production and this option was introduced in 5.0. Ah, well... At least the problem will solve itself in future, and the attribute approach must suffice for now. Best regards, Piotr MadaliĆski -----Original Message----- From: Liu Hao [mailto:lh_mo...@126.com] Sent: 2 sierpnia 2017 17:54 To: mingw-w64-public@lists.sourceforge.net; Madalinski Piotr <piotr.madalin...@zf.com> Subject: Re: [Mingw-w64-public] FW: Section sizes too big in object files (possible bug?) On 2017/8/2 19:42, Madalinski Piotr wrote: > Hi all, > > I'm having trouble with getting correct section sizes under MinGW. > The example below demonstrates the issue: > > (... abridgement ...) > > Adding align(1) attribute to the data definition is a workaround, that fixes > the problem, but due to external factors I want to avoid adding it, if > possible. > This behavior looks as a bug to me, but I can't say for sure. > Anyhow - is there some other (than the align(1) attribute) approach that this > behavior can be changed? Compiler option maybe? > `-malign-data=abi` shall fix the problem by minimizing the alignment requirement: ```plaintext E:\Desktop>gcc test.c -Wl,-s && objdump -h a.exe | grep -F test_sec grep: warning: GREP_OPTIONS is deprecated; please use an alias or script 2 test_sec 00000040 00404000 00404000 00001c00 2**5 E:\Desktop>gcc test.c -Wl,-s -malign-data=abi && objdump -h a.exe | grep -F test_sec grep: warning: GREP_OPTIONS is deprecated; please use an alias or script 2 test_sec 00000024 00404000 00404000 00001c00 2**2 ``` Reference: https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/x86-Options.html#x86-Options -- Best regards, LH_Mouse TRW Polska Sp. z o.o., ul. Rolnicza 33, 42-200 Czestochowa, Sad Rejonowy w Czestochowie, KRS nr 0000077409 NIP nr 573-010-52-34, kapital zakladowy: 79.581.975 PLN TRW Polska Sp. z o.o. Rolnicza 33 Str., 42-200 Czestochowa, Poland District Court for Czestochowa, KRS no. 0000077409, tax identification no. NIP 573-010-52-34, share capital: 79.581.975 PLN Niniejsza wiadomosc moze zawierac informacje poufne oraz/lub prawnie chronione, przeznaczone do wylacznego uzytku adresata. Jesli nie jestescie Panstwo adresatem przesylki lub jesli otrzymaliscie ja Panstwo omylkowo, prosimy o bezzwloczne skontaktowanie sie z nadawca i usuniecie tej wiadomosci. Wszelkie kopiowanie, wykorzystanie lub rozpowszechnianie tej wiadomosci czy tez zawartych w niej informacji przez osoby inne niz adresat jest niedozwolone i moze spowodowac odpowiedzialnosc prawna. This e-mail together with any attachments, may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail or any attachments is strictly forbidden. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public