Re: Problem with recent GNU ld packages

2003-10-20 Thread Brian Ford
Edouard Gomez ([EMAIL PROTECTED]) wrote:
I found the change that is responsible of my bug.

2003-04-15  Brian Ford  [EMAIL PROTECTED]

* peicode.h (coff_swap_scnhdr_in): If a section holds
uninitialized data and is from an object file or from an
executable image that has not initialized the s_size field, or if
the physical size is padded, use the virtual size (stored in
s_paddr) instead.

Yes.  See:

http://sources.redhat.com/ml/binutils/2003-10/msg00467.html

for a discussion.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Problem with recent GNU ld packages

2003-10-19 Thread Edouard Gomez
Hello,

I  am experiencing  problems  with  recent GNU  ld  packages. The  short
version is that  the COFF object file reader seems  to not determine the
.text  section correct  size, thus  ld panics,  complaining about  a bad
relocation.

I have also to make clear, that though i experience this using cross
compiling tools (linux-win32), cygwin users have the same problems,
that's why i post this bug report here (the binutils-bug list seems to
be a spam list)

Here is a more detailed report:


The  buggy  coff  file can  be  obtained  thanks  to the  assembly  file
attached. This  is the most  reduced code i  could do that  triggers the
bug.
 $ nasm -f elf -DPREFIX -o ld-bug.obj ld-bug.asm

When trying to link that file, i always have this error with GNU ld
2.14 (no errors with GNU ld 2.13):
ld-bug.obj: bad reloc address 0xa1 in section `.text'

So here we go, with a GNU ld 2.13, objdump -x reports that (only
relevent parts):
$ i386-mingw32-objdump -x ld-bug.obj
[...]
Sections:
Idx Nom   TailleVMA   LMA   Fich off  Algn
  0 .data 000c      0064  2**2
  CONTENTS, ALLOC, LOAD, DATA
  1 .text 00f3      0070  2**4
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
[...]

But GNU ld 2.14 (and current head cvs as well):
[...]
Sections:
Idx Nom   TailleVMA   LMA   Fich off  Algn
  0 .data 000c      0064  2**2
  CONTENTS, ALLOC, LOAD, DATA
  1 .text 000c      0070  2**4
  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
[...]

Note that the .text section is wrong in the second case.

I triedtodebug GNUld tofind wherethe
(section_type_struct)-_raw_size field was set...  but no luck. Is there
in this list a GNU ld (coff)  guru wanting to help me spot and crush the
bug ?

--
Edouard Gomez
BITS 32

;;
;; Macros
;;

%macro cglobal 1
%ifdef PREFIX
global _%1
%define %1 _%1
%else
global %1
%endif
%endmacro

%define CPUID_TSC   0x0010
%define CPUID_MMX   0x0080
%define CPUID_SSE   0x0200
%define CPUID_SSE2  0x0400

%define EXT_CPUID_3DNOW0x8000
%define EXT_CPUID_AMD_3DNOWEXT 0x4000
%define EXT_CPUID_AMD_MMXEXT   0x0040

%define XVID_CPU_MMX  (1 0)
%define XVID_CPU_MMXEXT   (1 1)
%define XVID_CPU_SSE  (1 2)
%define XVID_CPU_SSE2 (1 3)
%define XVID_CPU_3DNOW(1 4)
%define XVID_CPU_3DNOWEXT (1 5)
%define XVID_CPU_TSC  (1 6)

;; CHECK_FEATURE
;;   arg1: cpu feature bit as defined by the cpu spec
;;   arg2: cpu feature bit as defined in XviD
;;   arg3: register where to store the result
%macro  CHECK_FEATURE 3

mov ecx, %1
and ecx, edx
neg ecx
sbb ecx, ecx
and ecx, %2
or  %3, ecx

%endmacro

;;
;; Data
;;

SECTION .data

vendorAMD:
db AuthenticAMD

;;
;; Code
;;

SECTION .text

;;
;; uint32_t do_cpuid(void)
;; returns cpuid info

ALIGN 16
cglobal do_cpuid
do_cpuid:

pushebx
pushesi
pushedi
pushebp

xor ebp, ebp

; CPUID command ?
pushfd
pop eax
mov ecx, eax
xor eax, 0x0020
pusheax
popfd
pushfd
pop eax
cmp eax, ecx

jz  near .cpu_quit ; no CPUID command - exit


; get vendor string, used later
xor eax, eax
cpuid
mov [esp-12], ebx   ; vendor string
mov [esp-12+4], edx
mov [esp-12+8], ecx
testeax, eax

jz  near .cpu_quit

mov eax, 1
cpuid

; RDTSC command ?
CHECK_FEATURE CPUID_TSC, XVID_CPU_TSC, ebp

; MMX support ?
CHECK_FEATURE CPUID_MMX, XVID_CPU_MMX, ebp

; SSE support ?
CHECK_FEATURE CPUID_SSE, (XVID_CPU_MMXEXT|XVID_CPU_SSE), ebp

; SSE2 support?
CHECK_FEATURE CPUID_SSE2, XVID_CPU_SSE2, ebp

; extended functions?
mov eax, 0x8000
cpuid
cmp eax, 0x8000
jbe near .cpu_quit  ; No extended features, quit

; Yes there is
mov eax, 0x8001
cpuid

; Compare 

Re: Problem with recent GNU ld packages

2003-10-19 Thread Christopher Faylor
On Mon, Oct 20, 2003 at 03:16:15AM +0200, Edouard Gomez wrote:
Hello,

I  am experiencing  problems  with  recent GNU  ld  packages. The  short
version is that  the COFF object file reader seems  to not determine the
.text  section correct  size, thus  ld panics,  complaining about  a bad
relocation.

I have also to make clear, that though i experience this using cross
compiling tools (linux-win32), cygwin users have the same problems,
that's why i post this bug report here (the binutils-bug list seems to
be a spam list)

Check http://sourceware.org/lists.html for the binutils list.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/