src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Wed Feb  8 13:49:34 2017
--- new/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Wed Feb  8 13:49:33 2017

*** 1,7 **** --- 1,7 ---- /* ! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 34,51 **** --- 34,53 ---- import java.util.Map; import jdk.tools.jaotc.binformat.Symbol.Binding; import jdk.tools.jaotc.binformat.Symbol.Kind; import jdk.tools.jaotc.binformat.elf.JELFRelocObject; + import jdk.tools.jaotc.binformat.macho.JMachORelocObject; + import jdk.tools.jaotc.binformat.pecoff.JPECoffRelocObject; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; /** * A format-agnostic container class that holds various components of a binary. * * <p> * This class holds information necessary to create platform-specific binary containers such as - * ELFContainer for Linux and Solaris operating systems or yet-to be created MachOContainer for Mac * OS or PEContainer for MS Windows operating systems. * * <p> * Method APIs provided by this class are used to construct and populate platform-independent * contents of a binary as the first step to create a binary representation of code generated by a
*** 261,293 **** --- 263,295 ---- this.codeSegmentSize = config.codeSegmentSize; this.codeEntryAlignment = config.codeEntryAlignment; // read only, code codeContainer = new CodeContainer(".text", this); ! extLinkageContainer = new CodeContainer(".hotspot.linkage.plt", this); ! extLinkageContainer = new CodeContainer(".hs.plt.linkage", this); // read only, info configContainer = new ReadOnlyDataContainer(".config", this); - metaspaceNamesContainer = new ReadOnlyDataContainer(".metaspace.names", this); methodsOffsetsContainer = new ReadOnlyDataContainer(".methods.offsets", this); ! klassesOffsetsContainer = new ReadOnlyDataContainer(".klasses.offsets", this); ! klassesDependenciesContainer = new ReadOnlyDataContainer(".klasses.dependencies", this); ! klassesOffsetsContainer = new ReadOnlyDataContainer(".kls.offsets", this); ! klassesDependenciesContainer = new ReadOnlyDataContainer(".kls.dependencies", this); headerContainer = new HeaderContainer(jvmVersion, new ReadOnlyDataContainer(".header", this)); stubsOffsetsContainer = new ReadOnlyDataContainer(".stubs.offsets", this); codeSegmentsContainer = new ReadOnlyDataContainer(".code.segments", this); - constantDataContainer = new ReadOnlyDataContainer(".method.constdata", this); // needs relocation patching at load time by the loader - methodMetadataContainer = new ReadOnlyDataContainer(".method.metadata", this); // writable sections - metaspaceGotContainer = new ByteContainer(".metaspace.got", this); metadataGotContainer = new ByteContainer(".metadata.got", this); - methodStateContainer = new ByteContainer(".method.state", this); oopGotContainer = new ByteContainer(".oop.got", this); ! extLinkageGOTContainer = new ByteContainer(".hotspot.linkage.got", this); ! extLinkageGOTContainer = new ByteContainer(".hs.got.linkage", this); addGlobalSymbols(); recordConfiguration(config); }
*** 488,501 **** --- 490,513 ---- public void createBinary(String outputFileName, String aotVersion) throws IOException { String osName = System.getProperty("os.name"); switch (osName) { case "Linux": case "SunOS": ! JELFRelocObject elfso = new JELFRelocObject(this, outputFileName, aotVersion); ! elfso.createELFRelocObject(relocationTable, symbolTable.values()); ! JELFRelocObject elfobj = new JELFRelocObject(this, outputFileName, aotVersion); ! elfobj.createELFRelocObject(relocationTable, symbolTable.values()); + break; + case "Mac OS X": + JMachORelocObject machobj = new JMachORelocObject(this, outputFileName); + machobj.createMachORelocObject(relocationTable, symbolTable.values()); break; default: + if (osName.startsWith("Windows")) { + JPECoffRelocObject pecoffobj = new JPECoffRelocObject(this, outputFileName, aotVersion); + pecoffobj.createPECoffRelocObject(relocationTable, symbolTable.values()); + break; + } + else throw new InternalError("Unsupported platform: " + osName); } } /**
*** 733,747 **** --- 745,759 ---- container.appendInt(count); return offset; } /** - * Add constant data as follows. - Adding the data to the method.constdata section * * @param data * @param alignment - * @return the offset in the method.constdata of the data */ public int addConstantData(byte[] data, int alignment) { // Get the current length of the metaspaceNameContainer int constantDataOffset = alignUp(constantDataContainer, alignment); constantDataContainer.appendBytes(data, 0, data.length);

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