Web lists-archives.com

Multiple Issues: Porting UserMOde Linux, Unable to compile binutils 2.28; current ld linker doesn't support weak NT exrternals well, access denies exception running executable etc




Guys

Sorry for bothering the list for my issues. I am trying to port User
Mode Linux. I am just at the beginning stages. I downloaded the latest
Linux version and started hacking it. After making several code
modifications, I am able to fully compile the source code. Now I am
only able to create the executable using MSYS2 ld. Using CUGWIN I get
several undefined references. All the reference symbols are WEAK
external symbols.

Now, in MSYS2 I am using binutils 2.26. This version has a WEAK NT
external patch (https://sourceware.org/ml/binutils/2015-10/msg00234.html).
My version in CYGWIN is 2.25.2. So, I tried to compile the latest
version of binutils 2.28. That fails to compile with the following
error

In file included from plural.y:35:0:
plural-exp.h:102:23: error: conflicting types for ‘libintl_gettextparse’
 # define PLURAL_PARSE libintl_gettextparse
                       ^
plural.y:40:25: note: in expansion of macro ‘PLURAL_PARSE’
 # define __gettextparse PLURAL_PARSE
                         ^~~~~~~~~~~~
plural.c:182:5: note: in expansion of macro ‘__gettextparse’
 int __gettextparse (void);
     ^~~~~~~~~~~~~~
plural-exp.h:102:23: note: previous declaration of
‘libintl_gettextparse’ was here
 # define PLURAL_PARSE libintl_gettextparse
                       ^
plural-exp.h:114:12: note: in expansion of macro ‘PLURAL_PARSE’
 extern int PLURAL_PARSE PARAMS ((void *arg));
            ^~~~~~~~~~~~
plural-exp.h:102:23: error: conflicting types for ‘libintl_gettextparse’
 # define PLURAL_PARSE libintl_gettextparse
                       ^
plural.y:40:25: note: in expansion of macro ‘PLURAL_PARSE’
 # define __gettextparse PLURAL_PARSE
                         ^~~~~~~~~~~~
plural.c:63:25: note: in expansion of macro ‘__gettextparse’
 #define yyparse         __gettextparse
                         ^~~~~~~~~~~~~~
plural.c:1127:1: note: in expansion of macro ‘yyparse’
 yyparse (void)
 ^~~~~~~
plural-exp.h:102:23: note: previous declaration of
‘libintl_gettextparse’ was here
 # define PLURAL_PARSE libintl_gettextparse
                       ^
plural-exp.h:114:12: note: in expansion of macro ‘PLURAL_PARSE’
 extern int PLURAL_PARSE PARAMS ((void *arg));
            ^~~~~~~~~~~~
plural.c: In function ‘libintl_gettextparse’:
plural.c:64:25: error: too few arguments to function ‘__gettextlex’
 #define yylex           __gettextlex
                         ^
plural.c:1296:16: note: in expansion of macro ‘yylex’
       yychar = yylex (&yylval);
                ^~~~~
plural.c:64:25: note: declared here
 #define yylex           __gettextlex
                         ^
plural.y:69:12: note: in expansion of macro ‘yylex’
 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
            ^~~~~
plural.y:178:29: error: ‘arg’ undeclared (first use in this function)
      ((struct parse_args *) arg)->res = $1;
                             ^~~
plural.y:178:29: note: each undeclared identifier is reported only
once for each function it appears in
make[2]: *** [Makefile:133: plural.o] Error 1
make[2]: Leaving directory '/cygdrive/e/dev/GitHub/gnu/binutils-gdb/intl'
make[1]: *** [Makefile:6570: all-intl] Error 2
make[1]: Leaving directory '/cygdrive/e/dev/GitHub/gnu/binutils-gdb'
make: *** [Makefile:853: all] Error 2

Now, I go back an use the linker from MSYS2 and generate the
executable for Cygwin. When I run the executable, it runs very quickly
and returns. I debugging using gdb and I see a CFE somewhere inside
cygtls:call. I have tried many things to investigate why this is
happening, but I have been unable to get to the bottom of the problem.

I am thinking that this could be due to the use of LDS scripts to
generate the executable, but I really have no real clue that this
could be true. I also generated the executable by hand from the
vmlinux image using the command

gcc -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc -mcmodel=large
-Wl,--export-all-symbols -Wl,--enable-auto-import -o linux.exe vmlinux
-lws2_32

That still produce the same result. So, can someone help me diagnose
this problem better and address it, please?

I am your guinea pig.

Edison

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