delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/07/04/08:50:57

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: RE: ld bug
4 Jul 1998 08:50:57 -0700 :
Message-ID: <01BDA784.E78A8AE0.cygnus.cygwin32.developers@sos>
To: "'Ian Lance Taylor'" <ian AT cygnus DOT com>
Cc: "'cygwin32-developers AT cygnus DOT com'" <cygwin32-developers AT cygnus DOT com>

Sergey Okhapkin wrote:
> Ian Lance Taylor wrote:
> > I've reworked the way the linker handles grouped and orphaned
> > sections.  That should fix this problem.
> > 
> 
> Thanx! I'll try it.

It's possible now to compile/run an executable with user-defined sections, but now I see a problem with strip...

bash-2.01$ cat section.c
int __attribute__((section("mysection"))) i;
main(){printf("OK\n");}

bash-2.01$ gcc -o section section.c
bash-2.01$ objdump --headers section.exe

section.exe:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000200  00401000  000001c0  00000400  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         00000200  00402000  00000010  00000600  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 mysection     00000200  00403000  00000004  00000800  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  3 .bss          000000b8  00404000  00000000  00000000  2**2
                  ALLOC
  4 .rdata        00000200  00405000  00000014  00000a00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .idata        00000200  00406000  0000016c  00000c00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  6 .stab         00000400  00407000  000003c0  00000e00  2**2
                  CONTENTS, DEBUGGING, NEVER_LOAD
  7 .stabstr      00000c00  00408000  00000b93  00001200  2**0
                  CONTENTS, DEBUGGING, NEVER_LOAD
bash-2.01$ strip section.exe
bash-2.01$ objdump --headers section.exe

section.exe:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000200  00401000  000001c0  00000400  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         00000200  00402000  00000010  00000600  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2               00000200  00403000  00000004  00000800  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  3 .bss          000000b8  00404000  00000000  00000000  2**2
                  ALLOC
  4 .rdata        00000200  00405000  00000014  00000a00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .idata        00000200  00406000  0000016c  00000c00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
bash-2.01$

The second section name contains some unprintable characters now.

-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019