Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310007 - Mask USE=multitarget?? (WAS: gdb and binutils fail to emerge on Interix)
Summary: Mask USE=multitarget?? (WAS: gdb and binutils fail to emerge on Interix)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Interix
: High major (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-17 21:46 UTC by Sin Li
Modified: 2010-04-03 09:02 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sin Li 2010-03-17 21:46:49 UTC
The line that fails is   
memcpy (lwpstat.pr_context.uc_mcontext.gregs,gregs, sizeof (lwpstat.pr_context.uc_mcontext.gregs));

The problem: On Linux mcontext_t is defined as follows

/* Container for all general registers.  */
typedef greg_t gregset_t[NGREG];

/* Context to describe whole processor state.  */
typedef struct
  {
    gregset_t gregs;
    /* Due to Linux's history we have to use a pointer here.  The SysV/i386
       ABI requires a struct with the values.  */
    fpregset_t fpregs;
    unsigned long int oldmask;
    unsigned long int cr2;
  } mcontext_t;

So gregs ends up being an array pointer. On Interix (and possibly other Unices if the comment is to be believed) 

#ifdef _M_ALPHA
typedef struct {
    u_quad_t     fpregs[32];    /* floating point registers */
    u_quad_t     gregs[32];     /* general registers */
    u_quad_t     fpcr;          /* floating point control register */
    u_quad_t     softfpcr;      /* software extension to FPCR */
    u_quad_t     fir;           /* fault instruction continuation address */
    unsigned int psr;           /* processor status */
    unsigned int reserved[5];
} gregset_t;
#endif /* _M_ALPHA */

[...other architecture definitions follow]

typedef union {
    gregset_t gregs;
    fpregset_t fpregs;
} mcontext_t;

I think the solution is 

memcpy (&lwpstat.pr_context.uc_mcontext.gregs,gregs, sizeof (lwpstat.pr_context.uc_mcontext.gregs));

which passes a pointer to memcpy instead.

Reproducible: Always

Steps to Reproduce:
1.emerge binutils or emerge gdb
2.
3.

Actual Results:  
make[4]: Entering directory `/opt/gentoo/var/tmp/portage/sys-devel/gdb-7.0.1/work/gdb-7.0.1/bfd'
sh ./libtool --tag=CC   --mode=compile i586-pc-interix6.0-gcc -DHAVE_CONFIG_H -I. -DSTRICT_PE_FORMAT -I. -I. -I./../include   -DBINDIR='"/opt/gentoo/usr/bin"' -D_ALL_SOURCE -D_REENTRANT -W -Wall -Wstrict-prototypes -Wmissing-prototypes -D_ALL_SOURCE -D_REENTRANT -MT elf.lo -MD -MP -MF .deps/elf.Tpo -c -o elf.lo elf.c
libtool: compile:  i586-pc-interix6.0-gcc -DHAVE_CONFIG_H -I. -DSTRICT_PE_FORMAT -I. -I. -I./../include -DBINDIR=\"/opt/gentoo/usr/bin\" -D_ALL_SOURCE -D_REENTRANT -W -Wall -Wstrict-prototypes -Wmissing-prototypes -D_ALL_SOURCE -D_REENTRANT -MT elf.lo -MD -MP -MF .deps/elf.Tpo -c elf.c -o elf.o
elf.c: In function 'elfcore_write_lwpstatus':
elf.c:8522: error: incompatible type for argument 1 of 'memcpy'
Comment 1 Markus Duft (RETIRED) gentoo-dev 2010-03-18 06:43:41 UTC
you should really forget about gdb... i tried to get this to work for quite some time, and had absolutely no success. reading the patches microsoft had for the 10 years old gdb doesn't help either, since all of gdb was completely revamped in the meantime.

also, it would be helpfull to know which binutils version you're trying to build, and whats your emerge --info (did you set extra USE flags too?)...

Comment 2 Sin Li 2010-03-30 16:23:50 UTC
Oops, this was caused by USE="multitarget". Perhaps this should be masked?
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-03-30 16:44:49 UTC
(In reply to comment #2)
> Oops, this was caused by USE="multitarget". Perhaps this should be masked?
> 

Ok, then don't close the bug such that no one will remember to look for it again ;)
Comment 4 Fabian Groffen gentoo-dev 2010-04-03 09:02:20 UTC
Masked it for Interix