src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/Symbol.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat

src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/Symbol.java

Print this page


   1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package jdk.tools.jaotc.binformat;
  25 
  26 import java.util.Objects;
  27 
  28 import jdk.tools.jaotc.jnilibelf.ELFSymbol;
  29 
  30 public class Symbol {
  31 
  32     public enum Binding {
  33         UNDEFINED,
  34         LOCAL,
  35         GLOBAL
  36     }
  37 
  38     public enum Kind {
  39         UNDEFINED,
  40         NATIVE_FUNCTION,
  41         JAVA_FUNCTION,
  42         STATIC_STUB_CALL, // static call stub inside the text section
  43         OBJECT,
  44         NOTYPE
  45     }
  46 
  47     private final String name;
  48     private final int size;
  49     private final int offset;
  50     private final Binding binding;
  51     private final Kind kind;
  52 
  53     private ByteContainer section;
  54     private ELFSymbol elfSymbol;
  55 
  56     /**
  57      * Create symbol info.
  58      *
  59      * @param offset section offset for the defined symbol
  60      * @param kind kind of the symbol (UNDEFINED, FUNC, etc)
  61      * @param binding binding of the symbol (LOCAL, GLOBAL, ...)
  62      * @param section section in which this symbol is "defined"
  63      * @param size size of the symbol
  64      * @param name name of the symbol
  65      */
  66 
  67     public Symbol(int offset, Kind kind, Binding binding, ByteContainer section, int size, String name) {
  68         this.binding = binding;
  69         this.kind = kind;
  70         this.section = section;
  71         this.size = size;
  72         this.offset = offset;
  73         this.name = name;
  74     }
  75 
  76     public String getName() {
  77         return name;
  78     }
  79 
  80     public ELFSymbol getElfSymbol() {
  81         return elfSymbol;
  82     }
  83 
  84     public void setElfSymbol(ELFSymbol elfSymbol) {
  85         this.elfSymbol = elfSymbol;
  86     }
  87 
  88     public Binding getBinding() {
  89         return binding;
  90     }
  91 
  92     public Kind getKind() {
  93         return kind;
  94     }
  95 
  96     public int getSize() {
  97         return size;
  98     }
  99 
 100     public ByteContainer getSection() {
 101         return section;
 102     }
 103 
 104     public int getOffset() {
 105         return offset;


   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package jdk.tools.jaotc.binformat;
  25 
  26 import java.util.Objects;
  27 
  28 import jdk.tools.jaotc.binformat.NativeSymbol;
  29 
  30 public class Symbol {
  31 
  32     public enum Binding {
  33         UNDEFINED,
  34         LOCAL,
  35         GLOBAL
  36     }
  37 
  38     public enum Kind {
  39         UNDEFINED,
  40         NATIVE_FUNCTION,
  41         JAVA_FUNCTION,
  42         STATIC_STUB_CALL, // static call stub inside the text section
  43         OBJECT,
  44         NOTYPE
  45     }
  46 
  47     private final String name;
  48     private final int size;
  49     private final int offset;
  50     private final Binding binding;
  51     private final Kind kind;
  52 
  53     private ByteContainer section;
  54     private NativeSymbol nativeSymbol;
  55 
  56     /**
  57      * Create symbol info.
  58      *
  59      * @param offset section offset for the defined symbol
  60      * @param kind kind of the symbol (UNDEFINED, FUNC, etc)
  61      * @param binding binding of the symbol (LOCAL, GLOBAL, ...)
  62      * @param section section in which this symbol is "defined"
  63      * @param size size of the symbol
  64      * @param name name of the symbol
  65      */
  66 
  67     public Symbol(int offset, Kind kind, Binding binding, ByteContainer section, int size, String name) {
  68         this.binding = binding;
  69         this.kind = kind;
  70         this.section = section;
  71         this.size = size;
  72         this.offset = offset;
  73         this.name = name;
  74     }
  75 
  76     public String getName() {
  77         return name;
  78     }
  79 
  80     public NativeSymbol getNativeSymbol() {
  81         return nativeSymbol;
  82     }
  83 
  84     public void setNativeSymbol(NativeSymbol nativeSym) {
  85         this.nativeSymbol = nativeSym;
  86     }
  87 
  88     public Binding getBinding() {
  89         return binding;
  90     }
  91 
  92     public Kind getKind() {
  93         return kind;
  94     }
  95 
  96     public int getSize() {
  97         return size;
  98     }
  99 
 100     public ByteContainer getSection() {
 101         return section;
 102     }
 103 
 104     public int getOffset() {
 105         return offset;


src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/Symbol.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File