@Override public String getFilenamePrefix() { return ObjectFile.getNativeFormat() == ObjectFile.Format.PECOFF ? "" : "lib"; } },
public String getFilenameSuffix() { if (executable) { return ObjectFile.getNativeFormat() == ObjectFile.Format.PECOFF ? ".exe" : ""; } return ""; }
public static String getFilenameSuffix() { switch (ObjectFile.getNativeFormat()) { case ELF: case MACH_O: return ".o"; case PECOFF: return ".obj"; default: throw new AssertionError("unreachable"); } }
@Override public String getFilenameSuffix() { switch (ObjectFile.getNativeFormat()) { case ELF: return ".so"; case MACH_O: return ".dylib"; case PECOFF: return ".dll"; default: throw new AssertionError("unreachable"); } }
@Override LinkerInvocation getLinkerInvocation(Path outputDirectory, Path tempDirectory, String imageName) { String mainSymbolNameStem = NativeBootImage.globalSymbolNameForMethod(mainEntryPoint); // HACK: guess main symbol name using hacked-up knowledge of object file format String mainSymbolAlias = (ObjectFile.getNativeFormat() == ObjectFile.Format.MACH_O) ? "_main" : "main"; String mainSymbolName = (ObjectFile.getNativeFormat() == ObjectFile.Format.MACH_O) ? "_" + mainSymbolNameStem : mainSymbolNameStem; LinkerInvocation inv = super.getLinkerInvocation(outputDirectory, tempDirectory, imageName); inv.addSymbolAlias(mainSymbolAlias, mainSymbolName); return inv; } }
private static ObjectFile getNativeObjectFile(boolean runtimeDebugInfoGeneration) { switch (ObjectFile.getNativeFormat()) { case ELF: return new ELFObjectFile(runtimeDebugInfoGeneration); case MACH_O: return new MachOObjectFile(); case PECOFF: return new PECoffObjectFile(); default: throw new AssertionError("unreachable"); } }
public NativeBootImage(NativeImageKind k, HostedUniverse universe, HostedMetaAccess metaAccess, NativeLibraries nativeLibs, NativeImageHeap heap, NativeImageCodeCache codeCache, List<HostedMethod> entryPoints, HostedMethod mainEntryPoint, ClassLoader imageClassLoader) { super(k, universe, metaAccess, nativeLibs, heap, codeCache, entryPoints, imageClassLoader); uniqueEntryPoints.addAll(entryPoints); if (NativeImageOptions.MachODebugInfoTesting.getValue()) { objectFile = new MachOObjectFile(); } else { objectFile = ObjectFile.getNativeObjectFile(); if (objectFile == null) { throw new Error("Unsupported objectfile format: " + ObjectFile.getNativeFormat()); } } if (mainEntryPoint != null) { objectFile.setMainEntryPoint(globalSymbolNameForMethod(mainEntryPoint)); } objectFile.setByteOrder(ConfigurationValues.getTarget().arch.getByteOrder()); int pageSize = NativeImageOptions.PageSize.getValue(); if (pageSize > 0) { objectFile.setPageSize(pageSize); } wordSize = FrameAccess.wordSize(); assert objectFile.getWordSizeInBytes() == wordSize; }
LinkerInvocation getLinkerInvocation(Path outputDirectory, Path tempDirectory, String imageName) { CCLinkerInvocation inv; switch (ObjectFile.getNativeFormat()) { case MACH_O: inv = new DarwinCCLinkerInvocation();