[Bug binutils/2537] linker does not allow application to use value between SHT_LOUSER and SHT_HIUSER

2006-04-21 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2006-04-21 13:54 ---
Fixed by

http://sourceware.org/ml/binutils/2006-04/msg00283.html

-- 
   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=2537

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/2593] New: Cannot set the CONTENTS or LOAD flags

2006-04-21 Thread andrew dot stubbs at st dot com
Given the simplest program:

  int main()
  {
  }

and a simple linker script (not a real world example):

  SECTIONS
  {
.text   :
{
  *(.text .stub .text.* .gnu.linkonce.t.*)
} =0
.post_text_reserve :
{
  /* Reserve some space so we can drop something in here later */
  . += 0x160;
}
  }

compiled with:

  sh-elf-gcc test.c -T link2.ld -nostdlib

I get a file with the following properties:

  sh-elf-objdump -h a.out

  a.out: file format elf32-shl

  Sections:
  Idx Name  Size  VMA   LMA   File off  Algn
0 .text 000c      0080  2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .post_text_reserve 0160  000c  000c  008c  2**0
ALLOC
2 .comment  0043      008c  2**0
CONTENTS, READONLY

  sh-elf-readelf -S a.out

  There are 7 section headers, starting at offset 0x10c:

  Section Headers:
[Nr] Name  TypeAddr OffSize   ES Flg Lk Inf 
Al
[ 0]   NULL 00 00 000   0  0
[ 1] .text PROGBITS 80 0c 00 AX  0   0  
2
[ 2] .post_text_reserv NOBITS  000c 8c 000160 00 WA  0   0  
1
[ 3] .comment  PROGBITS 8c 43 000   0  1
[ 4] .shstrtab STRTAB   cf 3d 000   0  1
[ 5] .symtab   SYMTAB   000224 b0 106   8  4
[ 6] .strtab   STRTAB   0002d4 1c 000   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)

All is good so far.

Now I want to add the missing flags to the .post_test_reserve (the next step
would be to actually add some data).

So I do the following:

  sh-elf-objcopy --set-section-flags
.post_text_reserve=contents,alloc,load,readonly,code a.out a2.out

Now I get:

  sh-elf-objdump -h a2.out

  a2.out: file format elf32-shl

  Sections:
  Idx Name  Size  VMA   LMA   File off  Algn
0 .text 000c      0080  2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .post_text_reserve 0160  000c  000c  008c  2**0
ALLOC, READONLY, CODE
2 .comment  0043      01ec  2**0
CONTENTS, READONLY

  sh-elf-readelf -S a2.out

  There are 7 section headers, starting at offset 0x26c:

  Section Headers:
[Nr] Name  TypeAddr OffSize   ES Flg Lk Inf 
Al
[ 0]   NULL 00 00 000   0  0
[ 1] .text PROGBITS 80 0c 00 AX  0   0  
2
[ 2] .post_text_reserv NOBITS  000c 8c 000160 00 AX  0   0  
1
[ 3] .comment  PROGBITS 0001ec 43 000   0  1
[ 4] .shstrtab STRTAB   00022f 3d 000   0  1
[ 5] .symtab   SYMTAB   000384 b0 106   8  4
[ 6] .strtab   STRTAB   000434 1c 000   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)

The READONLY and CODE flags have been added, but the CONTENTS and LOAD flags
remain absent. Also, the ELF section type remains NOBITS, where it ought to be
PROGBITS.

After some examination of the source code and the ELF format I find that the
CONTENTS and LOAD flags are in fact implicit in the PROGBITS section type, so
all the above problems come down to the same issue.

AFAICT, the section type is set in elf_fake_sections(), but only if there is no
existing type (sh_type != SHT_NULL). In this case the section already has a type
- presumably loaded from the input file - and therefore does not have its type
set. Thus the change to the CONTENTS and LOAD flags is ignored.

The documentation says:

 `--set-section-flags SECTION=FLAGS'
  Set the flags for the named section.  The FLAGS argument is a
  comma separated string of flag names.  The recognized names are
  `alloc', `contents', `load', `noload', `readonly', `code', `data',
  `rom', `share', and `debug'.  You can set the `contents' flag for
  a section which does not have contents, but it is not meaningful
  to clear the `contents' flag of a section which does have
  contents-just remove the section instead.  Not all flags are
  meaningful for all object file formats.

What I want to do - set the contents flag - is explicitly described.

This used to work in 2.15.94.0.1 from kernel.org, but it

[Bug binutils/2584] SIGSEGV in strings tool when the file is crafted.

2006-04-21 Thread jolmos at isecauditors dot com


-- 
   What|Removed |Added

 CC||jolmos at isecauditors dot
   ||com


http://sourceware.org/bugzilla/show_bug.cgi?id=2584

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/2593] Cannot set the CONTENTS or LOAD flags

2006-04-21 Thread andrew dot stubbs at st dot com

--- Additional Comments From andrew dot stubbs at st dot com  2006-04-21 
16:05 ---
Subject: Re:  New: Cannot set the CONTENTS or LOAD flags

[moving the conversation to bugzilla ...]

Thanks H.J., but this does not seem to work for me. I cannot see any 
difference.

> On Fri, Apr 21, 2006 at 01:58:08PM +0100, Andrew STUBBS wrote:
>> > Hi all,
>> > 
>> > I have encountered an error setting the CONTENTS and LOAD flags with 
>> > relatively recent versions of objcopy/bfd.
>> > 
> 
> Could you please open a bug report with a simple testcase? This patch
> should work.
> 
> Thanks.
> 
> 
> H.J.
> 
> 2006-04-21  H.J. Lu  <[EMAIL PROTECTED]>
> 
>   * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type
>   and flags if its BFD flags has been set.
> 
> --- bfd/elf.c.copy2006-04-21 07:00:02.0 -0700
> +++ bfd/elf.c 2006-04-21 07:32:26.0 -0700
> @@ -2487,10 +2487,11 @@ _bfd_elf_new_section_hook (bfd *abfd, as
>bed = get_elf_backend_data (abfd);
>sec->use_rela_p = bed->default_use_rela_p;
>  
> -  /* When we read a file, we don't need section type and flags unless
> - it is a linker created section.  They will be overridden in
> - _bfd_elf_make_section_from_shdr anyway.  */
> -  if (abfd->direction != read_direction
> +  /* When we read a file or section BFD flags has been set, we don't
> + need section type and flags unless it is a linker created section.
> + They will be overridden in _bfd_elf_make_section_from_shdr
> + anyway.  */
> +  if ((!sec->flags && abfd->direction != read_direction)
>|| (sec->flags & SEC_LINKER_CREATED) != 0)
>  {
>ssect = (*bed->get_sec_type_attr) (abfd, sec);
> 



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2593

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/2593] Cannot set the CONTENTS or LOAD flags

2006-04-21 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2006-04-21 16:22 ---
Please provide a testcase I can reproduce with Linux/x86 or Linux/x86-64.

-- 
   What|Removed |Added

 CC||hjl at lucon dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=2593

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/2593] Cannot set the CONTENTS or LOAD flags

2006-04-21 Thread andrew dot stubbs at st dot com

--- Additional Comments From andrew dot stubbs at st dot com  2006-04-21 
16:49 ---
Created an attachment (id=977)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=977&action=view)
Input testcase for objcopy

This is the binary file produced by the method in the original report.

Additionally, I have modified the magic number so that it *looks* like an 80386
binary even though it is really an SH binary. (This was easier than building a
whole x86 toolchain just to produce an elf file.)

This allows the x86 objcopy to reproduce the problem.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2593

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/2593] Cannot set the CONTENTS or LOAD flags

2006-04-21 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2006-04-21 23:22 ---
A new patch is posted at

http://sourceware.org/ml/binutils/2006-04/msg00309.html

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2593

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/2596] New: Wrong code: linker relaxation for AVR

2006-04-21 Thread bjoern dot m dot haase at web dot de
The linker does not adjust the addresses included in initialized function 
tables (.data or .rodata) when these are subject to changes due to relaxation. 
 
A patch has been committed by me on the mailing list. If possible this patch 
should be applied prior to the final "17" release. 
 
I am submitting this bug report as kind of reminder so that one could get it 
into the 2.17 release. 
 
Bjoern.

-- 
   Summary: Wrong code: linker relaxation for AVR
   Product: binutils
   Version: 2.17
Status: NEW
  Severity: critical
  Priority: P2
 Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: bjoern dot m dot haase at web dot de
CC: bug-binutils at gnu dot org
 GCC build triplet: all
  GCC host triplet: all
GCC target triplet: avr-elf


http://sourceware.org/bugzilla/show_bug.cgi?id=2596

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils