Print this page
patch fix-lint
3317 dis(1) should support cross-target disassembly


   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 #
  22 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.


  24 #
  25 
  26 #
  27 # The build process for libdisasm is sightly different from that used by other
  28 # libraries, because libdisasm must be built in two flavors - as a standalone
  29 # for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
  30 # current flavor being built.
  31 #
  32 # The SPARC library is built from the closed gate.  This Makefile is shared
  33 # between both environments, so all paths must be absolute.
  34 #
  35 
  36 LIBRARY=        libdisasm.a
  37 STANDLIBRARY=   libstanddisasm.so
  38 VERS=           .1
  39 
  40 # By default, we build the shared library.  Construction of the standalone
  41 # is specifically requested by architecture-specific Makefiles.
  42 TYPES=          library
  43 CURTYPE=        library
  44 
  45 COMDIR=         $(SRC)/lib/libdisasm/common
  46 
  47 #
  48 # Architecture-dependent files common to both versions of libdisasm
  49 #
  50 OBJECTS_common_i386 = dis_i386.o dis_tables.o
  51 OBJECTS_common_sparc = dis_sparc.o instr.o dis_sparc_fmt.o
  52 
  53 SRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c
  54 SRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c $(ISASRCDIR)/instr.c \
  55         $(ISASRCDIR)/dis_sparc_fmt.c
  56 
  57 #
  58 # Architecture-independent files common to both version of libdisasm
  59 #
  60 OBJECTS_common_common = libdisasm.o
  61 SRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c)



  62 





  63 
  64 OBJECTS=                                \
  65         $(OBJECTS_common_$(MACH))       \
  66         $(OBJECTS_common_common)








  67 
  68 include $(SRC)/lib/Makefile.lib
  69 
  70 SRCS=                                   \
  71         $(SRCS_$(CURTYPE))              \
  72         $(SRCS_common_$(MACH))          \
  73         $(SRCS_common_common)


  74 
  75 #
  76 # Used to verify that the standalone doesn't have any unexpected external
  77 # dependencies.
  78 #
  79 LINKTEST_OBJ = objs/linktest_stand.o
  80 
  81 CLOBBERFILES_standalone = $(LINKTEST_OBJ)
  82 CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
  83 
  84 LIBS_standalone = $(STANDLIBRARY)
  85 LIBS_library = $(DYNLIB) $(LINTLIB)
  86 LIBS = $(LIBS_$(CURTYPE))
  87 
  88 MAPFILES =      $(COMDIR)/mapfile-vers
  89 
  90 LDLIBS +=       -lc
  91 
  92 LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r
  93 LDFLAGS = $(LDFLAGS_$(CURTYPE))
  94 
  95 ASFLAGS_standalone = -DDIS_STANDALONE
  96 ASFLAGS_library =
  97 ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
  98 
  99 $(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC)
 100 
 101 CERRWARN +=     -_gcc=-Wno-parentheses
 102 CERRWARN +=     -_gcc=-Wno-uninitialized
 103 
 104 # We want the thread-specific errno in the library, but we don't want it in
 105 # the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
 106 # in order to enable this feature.  Conveniently, -D_REENTRANT does the same
 107 # thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
 108 # doesn't get it.
 109 DTS_ERRNO=
 110 
 111 # We need to rename some standard functions so we can easily implement them 
 112 # in consumers.
 113 STAND_RENAMED_FUNCS= \
 114         snprintf
 115 
 116 CPPFLAGS_standalone = -DDIS_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=mdb_%) \
 117         -Dvsnprintf=mdb_iob_vsnprintf -I$(SRC)/cmd/mdb/common
 118 CPPFLAGS_library = -D_REENTRANT
 119 CPPFLAGS +=     -I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
 120 
 121 #
 122 # For x86, we have to link to sources in usr/src/common
 123 #
 124 CPPFLAGS_dis_i386 = -I$(SRC)/common/dis/i386 -DDIS_TEXT
 125 CPPFLAGS_dis_sparc =
 126 CPPFLAGS +=     $(CPPFLAGS_dis_$(MACH))
 127 
 128 CFLAGS_standalone = $(STAND_FLAGS_32)
 129 CFLAGS_common =
 130 CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
 131 
 132 CFLAGS64_standalone = $(STAND_FLAGS_64)
 133 CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
 134 
 135 DYNFLAGS +=     $(ZINTERPOSE)
 136 
 137 .KEEP_STATE:


   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 #
  22 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
  25 # Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  26 #
  27 
  28 #
  29 # The build process for libdisasm is sightly different from that used by other
  30 # libraries, because libdisasm must be built in two flavors - as a standalone
  31 # for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
  32 # current flavor being built.
  33 #



  34 
  35 LIBRARY=        libdisasm.a
  36 STANDLIBRARY=   libstanddisasm.so
  37 VERS=           .1
  38 
  39 # By default, we build the shared library.  Construction of the standalone
  40 # is specifically requested by architecture-specific Makefiles.
  41 TYPES=          library
  42 CURTYPE=        library
  43 
  44 COMDIR=         $(SRC)/lib/libdisasm/common
  45 
  46 #
  47 # Architecture-independent files
  48 #
  49 SRCS_common=            $(COMDIR)/libdisasm.c
  50 OBJECTS_common=         libdisasm.o




  51 
  52 #
  53 # Architecture-dependent disassembly files
  54 #
  55 SRCS_i386=              $(COMDIR)/dis_i386.c \
  56                         $(SRC)/common/dis/i386/dis_tables.c
  57 SRCS_sparc=             $(COMDIR)/dis_sparc.c \
  58                         $(COMDIR)/dis_sparc_fmt.c \
  59                         $(COMDIR)/dis_sparc_instr.c
  60 
  61 OBJECTS_i386=           dis_i386.o \
  62                         dis_tables.o
  63 OBJECTS_sparc=          dis_sparc.o \
  64                         dis_sparc_fmt.o \
  65                         dis_sparc_instr.o
  66 
  67 #
  68 # We build the regular shared library with support for all architectures.
  69 # The standalone version should only contain code for the native
  70 # architecture to reduce the memory footprint of kmdb.
  71 #
  72 OBJECTS_library=        $(OBJECTS_common) \
  73                         $(OBJECTS_i386) \
  74                         $(OBJECTS_sparc)
  75 OBJECTS_standalone=     $(OBJECTS_common) \
  76                         $(OBJECTS_$(MACH))
  77 OBJECTS=                $(OBJECTS_$(CURTYPE))
  78 
  79 include $(SRC)/lib/Makefile.lib
  80 
  81 SRCS_library=           $(SRCS_common) \
  82                         $(SRCS_i386) \
  83                         $(SRCS_sparc)
  84 SRCS_standalone=        $(SRCS_common) \
  85                         $(SRCS_$(MACH))
  86 SRCS=                   $(SRCS_$(CURTYPE))
  87 
  88 #
  89 # Used to verify that the standalone doesn't have any unexpected external
  90 # dependencies.
  91 #
  92 LINKTEST_OBJ = objs/linktest_stand.o
  93 
  94 CLOBBERFILES_standalone = $(LINKTEST_OBJ)
  95 CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
  96 
  97 LIBS_standalone = $(STANDLIBRARY)
  98 LIBS_library = $(DYNLIB) $(LINTLIB)
  99 LIBS = $(LIBS_$(CURTYPE))
 100 
 101 MAPFILES =      $(COMDIR)/mapfile-vers
 102 
 103 LDLIBS +=       -lc
 104 
 105 LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r
 106 LDFLAGS = $(LDFLAGS_$(CURTYPE))
 107 
 108 ASFLAGS_standalone = -DDIS_STANDALONE
 109 ASFLAGS_library =
 110 ASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM
 111 
 112 $(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC)
 113 
 114 CERRWARN +=     -_gcc=-Wno-parentheses
 115 CERRWARN +=     -_gcc=-Wno-uninitialized
 116 
 117 # We want the thread-specific errno in the library, but we don't want it in
 118 # the standalone.  $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS),
 119 # in order to enable this feature.  Conveniently, -D_REENTRANT does the same
 120 # thing.  As such, we null out $(DTS_ERRNO) to ensure that the standalone
 121 # doesn't get it.
 122 DTS_ERRNO=
 123 
 124 CPPFLAGS_standalone = -DDIS_STANDALONE -I$(SRC)/cmd/mdb/common






 125 CPPFLAGS_library = -D_REENTRANT
 126 CPPFLAGS +=     -I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
 127 
 128 # For the x86 disassembler we have to include sources from usr/src/common
 129 CPPFLAGS += -I$(SRC)/common/dis/i386 -DDIS_TEXT




 130 
 131 CFLAGS_standalone = $(STAND_FLAGS_32)
 132 CFLAGS_common =
 133 CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
 134 
 135 CFLAGS64_standalone = $(STAND_FLAGS_64)
 136 CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
 137 
 138 DYNFLAGS +=     $(ZINTERPOSE)
 139 
 140 .KEEP_STATE: