Monday, 15 August 2011

c - shade cachesim5 simluator linker error -



c - shade cachesim5 simluator linker error -

i trying compile sun sparc's shade cachesim5 simulator on sparc machine using sun studio 12. when seek "make" file, getting error (maybe) linker error.

> create cc -i../../../inc -o -dspix_addr=64 -wl,-m,../../../lib/mapfile -o cachesim5 cachesim5.o ../../../lib/libshade.a ../../../lib/libspix_sparc.a ld: warning: file ../../../lib/libshade.a(if_lockmem.o): wrong elf class: elfclass64 ld: warning: file ../../../lib/libspix_sparc.a(itypes.o): wrong elf class: elfclass64 undefined first referenced symbol in file shade_appstatus cachesim5.o main /opt/solarisstudio12.3/prod/lib/crt1.o shade_print_opt_info cachesim5.o shade_trsize cachesim5.o shade_malloc cachesim5.o shade_getoptv cachesim5.o spix_sparc_iop_memsize cachesim5.o shade_iset_newclass cachesim5.o shade_run cachesim5.o shade_tset_new cachesim5.o shade_trctl cachesim5.o shade_usage cachesim5.o shade_error cachesim5.o spix_sparc_iop_istype cachesim5.o shade_fp cachesim5.o ld: fatal: symbol referencing errors. no output written cachesim5 *** error code 2 make: fatal error: command failed target `cachesim5'

for illustration "shade_print_opt_info" defined in "getopt.h" file under "../../../inc" directive , included in header file of "cachesim5.c".

here "getopt.h":

#ifndef _getopt_h_ 7 #define _getopt_h_ 8 9 //errors: 10 typedef enum 11 { 12 getopt_no_param_err, 13 getopt_invalid_option_err, 14 getopt_excess_param_err, 15 getopt_erange_err, 16 getopt_einval_err, 17 getopt_not_an_option_err, 18 getopt_invalid_param_err 19 } getopt_error_t; 20 21 22 typedef enum 23 { 24 no_param, 25 int_param, 26 char_param, 27 str_param 28 } getopt_param_t; 29 30 typedef union shade_option_val 31 { 32 int ival; 33 char cval; 34 const char *sval; 35 struct 36 { 37 getopt_error_t err; 38 int opt; 39 } err_info; 40 } shade_option_val_t; 41 42 typedef struct shade_options 43 { 44 const char *name; 45 const char *helpstr; 46 const struct shade_options *subopts; 47 getopt_param_t param_type; 48 } shade_options_t; 49 50 int shade_getopt(const char *str, const shade_options_t * opts, 51 shade_option_val_t * value); 52 int shade_getoptv(int argc, char *argv[], int *optind, int *n_undef_item, 53 const shade_options_t * opts, shade_option_val_t * value); 54 void shade_print_opt_info(const shade_options_t * opts, int info_indent); 55 56 #endif //_getopt_h

makefile:

obj = cachesim5.o targ = cachesim5 shadekit = ../../.. libs = $(shadekit)/lib/libshade.a \ $(shadekit)/lib/libspix_sparc.a mapfile = $(shadekit)/lib/mapfile inc = -i$(shadekit)/inc opt = -o defs = -dspix_addr=64 $(arch_defs) cflags = $(inc) $(opt) $(defs) ldflags = -wl,-m,$(mapfile) build: $(targ) $(targ): $(obj) $(libs) $(mapfile) $(cc) $(cflags) $(ldflags) -o $@ $(obj) $(libs) clean: rm -f $(obj) clobber: clean rm -f $(targ)

finally portion of "cachesim5.c":

#pragma ident "@(#)shade , spixtools v6.1 (beta 2.0.28)" 9 10 #include <stdlib.h> 11 #include <string.h> 12 #include <stdio.h> 13 #include <assert.h> 14 #include <unistd.h> 15 #include <errno.h> 16 #include <sys/processor.h> 17 18 #include <spix_sparc.h> 19 #include <shade.h> 20 #include <shade_anal.h> 21 #include "getopt.h"

............................................ ..............................................

673 void shadeuser_analusage(void) 674 { 675 676 fprintf(stderr, "-{idu}<sz>[b<bsz>[,<subbsz>]][s<assoc>][r<replace>]" 677 "[wb][wt][wa][wi][i<cache>] - cache parameters:\n"); 678 fprintf(stderr, "\t\t-{i|d|u} select instruction, data, unified cache;\n"); 679 fprintf(stderr, "\t\t<sz> overall cache size in bytes (suffix k 1024x, etc.);\n"); 680 fprintf(stderr, "\t\tb<bsz>[,<bbsz>] block , subblock sizes in bytes;\n"); 681 fprintf(stderr, "\t\t[s<#sets>] set associativity (1 direct mapped (default));\n"); 682 fprintf(stderr, "\t\t[r<replace>] set replacement: lru, random, viking, plru, lfsr, nvlfsr, nvctr;\n"); 683 684 fprintf(stderr, "\t\t[wt|wb] write thru or write back;\n"); 685 fprintf(stderr, "\t\t[wa] write allocate;\n"); 686 fprintf(stderr, "\t\t[wi] write invalidate;\n"); 687 fprintf(stderr, "\t\t[i<cache>] include cache (e.g. i1 1st level cache);\n"); 688 689 fprintf(stderr, "-single-cpu - \tsimulate threads on single cpu;\n"); 690 fprintf(stderr, "-pcs - \toutput per-cpu cache statistics;\n"); 691 692 shade_print_opt_info(shadeuser_opts, 0); 693 }

your help much appreciated.

*******update*********** after adding -m64 flag, elfclass error gone. there errors of undefined functions/symbols:

> create cc -i../../../inc -o -dspix_addr=64 -m64 -c cachesim5.c "cachesim5.c", line 382: warning: function prototype parameters must have types cc -i../../../inc -o -dspix_addr=64 -m64 -wl,-m,../../../lib/mapfile -o cachesim5 cachesim5.o ../../../lib/libshade.a ../../../lib/libspix_sparc.a undefined first referenced symbol in file _lwp_makecontext ../../../lib/libshade.a(si_hostthds.o) _lwp_create ../../../lib/libshade.a(si_hostthds.o) _signotifywait ../../../lib/libshade.a(si_hostthds.o) _lwp_getprivate ../../../lib/libshade.a(si_timer.o) _lwp_sigredirect ../../../lib/libshade.a(si_hostthds.o) _lwp_wait ../../../lib/libshade.a(si_lwpfix.o) ld: fatal: symbol referencing errors. no output written cachesim5 *** error code 2 make: fatal error: command failed target `cachesim5'

c compiler-errors linker-error sparc sunstudio

No comments:

Post a Comment