> and you get the following from objdump:
>[ 20](sec  4)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000
>test_struct
>[ 21](sec  4)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000024 a
>[ 22](sec  4)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000028 b

>With the section size of 0x40.  In fact, when adding another copy of the test 
>structure after a, you will get the second one starting at 0x40, with a 
>section size of 0x80.  This is no >optimization, by the way.

>NOTE: this is without ANY optimization flags.  If you compile with -O1, you get
>[ 20](sec  7)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 b
>[ 21](sec  7)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000004 a
>[ 22](sec  7)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000020
>test_struct

Well, yes, I suppose the location of variables in a single section is not 
deterministic.
But I'm using only one variable per section (actually I'm using -data-sections 
option),
and am arranging the sections in the linker script to create a memory region 
that can be mmaped form external file.

The linker script looks something like this:
 .mmaped_region BLOCK(__section_alignment__) : SUBALIGN(1)
 {
*(.test_section1)
*(.test_section2)
}
The problem is that by default test_section1 is too big because of the padding, 
and test_section2 ends up in the wrong place.

Best regards,
Piotr Madalinski.

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

Reply via email to