This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Map GNU attributes section to PT_GNU_ATTR (aka PT_GNU_STACK) segment


On Thu, Aug 16, 2007 at 07:26:36AM -0400, Daniel Jacobowitz wrote:
> On Wed, Aug 15, 2007 at 10:07:12AM -0700, H.J. Lu wrote:
> > 2007-08-15  H.J. Lu  <hongjiu.lu@intel.com>
> > 
> > 	* elf.c (get_segment_type): Change PT_GNU_STACK to PT_GNU_ATTR.
> > 	(bfd_section_from_phdr): Likewise.
> > 	(get_program_header_size): Likewise. Add a PT_GNU_ATTR segment
> > 	if there is an attribute section.
> > 	(_bfd_elf_map_sections_to_segments): Likewise.
> > 	(IS_SECTION_IN_INPUT_SEGMENT): Likewise.
> 
> How is this going to work?  .gnu.attributes is not SEC_ALLOC.  Also,
> I'm not sure we can make .ARM.attributes SEC_ALLOC without breaking
> the ARM EABI.
> 

Why does the attribute section have to be SEC_ALLOC?  That is what
I got:

[hjl@gnu-6 attr-1]$ ./readelf -lS x
There are 6 section headers, starting at offset 0x8064:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00008000 008000 000004 00  AX  0   0  4
  [ 2] .ARM.attributes   ARM_ATTRIBUTES  00000000 008004 00002c 00      0   0  1
  [ 3] .shstrtab         STRTAB          00000000 008030 000031 00      0   0  1
  [ 4] .symtab           SYMTAB          00000000 008154 000110 10      5   6  4
  [ 5] .strtab           STRTAB          00000000 008264 000097 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x8000
There are 2 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x008000 0x00008000 0x00008000 0x00004 0x00004 R E 0x8000
  GNU_ATTR       0x008004 0x00000000 0x00000000 0x0002c 0x00000 RW  0x1

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01     .ARM.attributes
[hjl@gnu-6 attr-1]$

Run-time loader can access the attribute section by checking offset
and filesize without making it SEC_ALLOC.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]