supposed bug in assembler "as"

2007-11-06 Thread Daniela Rütting
Hello,
I encountered a problem which seems to be a bug in the assembler 'as':
Redefining a symbol with the '.set' directive in connection with the location 
counter does not work correctly.
I am using:
GNU assembler 2.14 20030612, configured for `i586-pc-msdosdjgpp', getting to 
DOS from Windows 98.

I hope that the condensed little program I append (also in the file 
'astest.S'), while isolating the supposed bug, contains all necessary 
information.

Greetings from Germany,  B. Strowitzki 

#- start of sample program 
 .section .data
 .p2align 4,,15
somedata: .int 1,2,3,4,5,6,7,8,9,0  /* dummy values */
 .set goodval_1, (.-somedata)/4  /* calculate number of entries */
 .set badval, (.-somedata)/4
startval: .int badval /* retaining badval for later printing */
/*  in real program to be stored into a "C"-defined struct
producing an entry like "datablock.length" */

moredata:
 .rept 1024
 .byte 32
 .endr
 .set goodval_2, (.-moredata)  /* same procedure again */
 .set badval, (.-moredata) /* redefining badval, ok */
midval: .int badval

evenmoredata: .space 200
 .set goodval_3, (.-evenmoredata)
 .set badval, (.-evenmoredata)  /* third definition: doesn't work!
   'as' seems to get confused   */
#  /* shortcut with self-diagnosis by 'as' */
#  /* gives an extra error message, but works */
#.if (goodval_3-badval) 
#.print "difference encountered"
#.err
#.endif
breakval: .int badval

lastdata:
 .space 1200, -1
 .set goodval_4, (.-lastdata)/4
 .set badval, (.-lastdata)/4  /* doesn't work also */

# further strange behavior
 .set dotval_good_1, .
 .set dotval_bad, .
firstdot: .int dotval_bad   /* no problem so far */
 .space 12  /* dummy */
 .set dotval_good_2, .
 .set dotval_bad, .   /* corrupts the value already stored in 'firstdot' */
nextdot: .int dotval_bad  

format: .asciz " %i. right val: %i,  badval: %i\12\15"
 .section .text
 .p2align 4,,15
.globl _main
_main:
   pushl %ebp
   movl %esp,%ebp

movl $startval,%eax
pushl (%eax)
pushl $goodval_1
pushl $1
pushl $format
call _printf/* emits equal numbers, ok */

movl $midval,%eax
pushl (%eax)
pushl $goodval_2
pushl $2
pushl $format
call _printf/* emits equal numbers, ok */

movl $breakval,%eax
pushl (%eax)
pushl $goodval_3
pushl $3
pushl $format
call _printf  /* emits two different numbers */

pushl $badval
pushl $goodval_4
pushl $4
pushl $format
call _printf   /* different numbers again */

pushl $10   /* newline */
call _putch

movl $firstdot,%eax
pushl (%eax)
pushl $dotval_good_1
pushl $5
pushl $format
call _printf  /* emits two different numbers
 with last value assigned to 'dotval_bad' */

movl $nextdot,%eax
pushl (%eax)
pushl $dotval_good_2
pushl $6
pushl $format
call _printf  /* emits equal numbers, ok */

   xorl %eax,%eax   /* exit code zero */
   movl %ebp,%esp
   popl %ebp
   ret



_
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=0066



astest.S
Description: Binary data
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/5276] New: relax is not yet perfect. fails linking large c++

2007-11-06 Thread oliver at linux-kernel dot at
Last time I tried rebuilding firefox 2.0.0.8 rpm from Fedora on my Alpha it
failed with some relocation problems like this:

... relocation truncated to fit: GPREL16 against symbol ...

(Build log: http://buildsys.zero42.at/koji/getfile?taskID=53055&name=build.log)

I know this error very well, because I've seen it many times when using relaxed
binutils, especially when linking large c++ stuff.

So to prove this, I today tried to build firefox 2.0.0.9 again and a similar
problem occured. After the failed build I added -Wl,--no-relax to my LDFLAGS.
Well, you can expect what happened: It finished building. It - of course - took
longer to build, but worked...

Do you need any input? I'm willing to give ssh access to the build machine if
that helps!

-- 
   Summary: relax is not yet perfect. fails linking large c++
   Product: binutils
   Version: 2.17
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: oliver at linux-kernel dot at
CC: bug-binutils at gnu dot org
 GCC build triplet: alpha-redhat-linux
  GCC host triplet: alpha-redhat-linux
GCC target triplet: alpha-redhat-linux


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

--- 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


Re: supposed bug in assembler "as"

2007-11-06 Thread Nick Clifton

Hi Daniela,


Redefining a symbol with the '.set' directive in connection with the location 
counter does not work correctly.
I am using:
GNU assembler 2.14


This is your problem.  Version 2.14 is an old version which was known to have 
problems in this area.  The current release is 2.18.  Please upgrade to this 
release and you should find that everything works.


Cheers
  Nick


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


[Bug binutils/5278] New: objdump SEGFAULT in _bfd_pe_print_private_bfd_data_common

2007-11-06 Thread julia at fireeye dot com
Several Win32 PE files, which appear to be UPX compressed, with broken/tweeked
headers, cause SEGFAULTs (sig 11) when run as "objdump -x foo.exe"

Example backtrace:
The Export Tables (interpreted UPX1 section contents)

Export Flagseb34e215
Time/Date stamp ebd57074
Major/Minor -21660/-29690

Program received signal SIGSEGV, Segmentation fault.
0x2ab3ac7a2cb0 in strlen () from /lib/tls/libc.so.6
(gdb) bt
#0  0x2ab3ac7a2cb0 in strlen () from /lib/tls/libc.so.6
#1  0x2ab3ac775c8d in vfprintf () from /lib/tls/libc.so.6
#2  0x2ab3ac77b588 in fprintf () from /lib/tls/libc.so.6
#3  0x2ab3ac5ba698 in _bfd_pe_print_private_bfd_data_common () from
/usr/lib64/binutils/x86_64-pc-linux-gnu/2.18/libbfd-2.18.so
#4  0x2ab3ac5b3d89 in pe_print_private_bfd_data () from
/usr/lib64/binutils/x86_64-pc-linux-gnu/2.18/libbfd-2.18.so
#5  0x0040769a in dump_bfd ()
#6  0x00407f39 in display_bfd ()
#7  0x0040807d in display_file ()
#8  0x00408633 in main ()
(gdb)

-- 
   Summary: objdump SEGFAULT in
_bfd_pe_print_private_bfd_data_common
   Product: binutils
   Version: 2.18
Status: NEW
  Severity: critical
  Priority: P2
 Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: julia at fireeye dot com
CC: bug-binutils at gnu dot org


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

--- 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/5279] New: objdump SEGFAULT in bfd_getl16

2007-11-06 Thread julia at fireeye dot com
In certain Win32 PE (i386) EXE files (which might be packed), objdump segfaults
due to something in the PE headers. I can provide an example .EXE file to
reproduce this.

Reproduction: "objdump -x foo.exe"

Example backtrace:
[...]
191009  0  RegQueryValueA   191009
19101b  0  RegSetValueA 19101b
19102b  0  RegSetValueExA   19102b

 00190014   0019015c  03e7 00190f21 00190334

DLL Name: KERNEL32.dll
vma:  Hint/Ord Member-Name Bound-To

Program received signal SIGSEGV, Segmentation fault.
0x2ab55058b150 in bfd_getl16 () from
/usr/lib64/binutils/x86_64-pc-linux-gnu/2.18/libbfd-2.18.so
(gdb) bt
#0  0x2ab55058b150 in bfd_getl16 () from
/usr/lib64/binutils/x86_64-pc-linux-gnu/2.18/libbfd-2.18.so
#1  0x2ab5505e00fa in _bfd_pe_print_private_bfd_data_common () from
/usr/lib64/binutils/x86_64-pc-linux-gnu/2.18/libbfd-2.18.so
#2  0x2ab5505d8d89 in pe_print_private_bfd_data () from
/usr/lib64/binutils/x86_64-pc-linux-gnu/2.18/libbfd-2.18.so
#3  0x0040769a in dump_bfd ()
#4  0x00407f39 in display_bfd ()
#5  0x0040807d in display_file ()
#6  0x00408633 in main ()
(gdb)

-- 
   Summary: objdump SEGFAULT in bfd_getl16
   Product: binutils
   Version: 2.18
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: julia at fireeye dot com
CC: bug-binutils at gnu dot org


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

--- 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/5276] relax is not yet perfect. fails linking large c++

2007-11-06 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2007-11-07 04:51 ---
Can you try binutils 2.18?

-- 
   What|Removed |Added

 CC||hjl at lucon dot org
 Status|NEW |WAITING


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

--- 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/5279] objdump SEGFAULT in bfd_getl16

2007-11-06 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2007-11-07 04:53 ---
Please provide testcases.

-- 
   What|Removed |Added

 CC||hjl at lucon dot org
 Status|NEW |WAITING


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

--- 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/5278] objdump SEGFAULT in _bfd_pe_print_private_bfd_data_common

2007-11-06 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2007-11-07 04:54 ---
Please provide testcase

-- 
   What|Removed |Added

 CC||hjl at lucon dot org


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

--- 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