--- old/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java 2017-02-08 13:49:34.605773105 -0500 +++ new/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java 2017-02-08 13:49:33.149689162 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -36,6 +36,8 @@ 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; /** @@ -43,7 +45,7 @@ * *

* 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 + * ELFContainer for Linux and Solaris operating systems or MachOContainer for Mac * OS or PEContainer for MS Windows operating systems. * *

@@ -263,29 +265,29 @@ // 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); + metaspaceNamesContainer = new ReadOnlyDataContainer(".meta.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); + constantDataContainer = new ReadOnlyDataContainer(".meth.constdata", this); // needs relocation patching at load time by the loader - methodMetadataContainer = new ReadOnlyDataContainer(".method.metadata", this); + methodMetadataContainer = new ReadOnlyDataContainer(".meth.metadata", this); // writable sections - metaspaceGotContainer = new ByteContainer(".metaspace.got", this); + metaspaceGotContainer = new ByteContainer(".meta.got", this); metadataGotContainer = new ByteContainer(".metadata.got", this); - methodStateContainer = new ByteContainer(".method.state", this); + methodStateContainer = new ByteContainer(".meth.state", this); oopGotContainer = new ByteContainer(".oop.got", this); - extLinkageGOTContainer = new ByteContainer(".hotspot.linkage.got", this); + extLinkageGOTContainer = new ByteContainer(".hs.got.linkage", this); addGlobalSymbols(); @@ -490,11 +492,21 @@ 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: - throw new InternalError("Unsupported platform: " + osName); + if (osName.startsWith("Windows")) { + JPECoffRelocObject pecoffobj = new JPECoffRelocObject(this, outputFileName, aotVersion); + pecoffobj.createPECoffRelocObject(relocationTable, symbolTable.values()); + break; + } + else + throw new InternalError("Unsupported platform: " + osName); } } @@ -735,11 +747,11 @@ } /** - * Add constant data as follows. - Adding the data to the method.constdata section + * Add constant data as follows. - Adding the data to the meth.constdata section * * @param data * @param alignment - * @return the offset in the method.constdata of the data + * @return the offset in the meth.constdata of the data */ public int addConstantData(byte[] data, int alignment) { // Get the current length of the metaspaceNameContainer