< prev index next >

src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Linker.java

Print this page
rev 59103 : imported patch hotspot


  66         String name = options.outputName;
  67         objectFileName = name;
  68         libraryFileName = name;
  69 
  70         if (options.linkerpath != null && !(new File(options.linkerpath).exists())) {
  71             throw new InternalError("Invalid linker path: " + options.linkerpath);
  72         }
  73         String linkerPath;
  74         String linkerCheck;
  75 
  76         switch (options.osName) {
  77             case "Linux":
  78                 if (name.endsWith(".so")) {
  79                     objectFileName = name.substring(0, name.length() - ".so".length());
  80                 }
  81                 objectFileName = objectFileName + ".o";
  82                 linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
  83                 linkerCmd = linkerPath + " -shared -z noexecstack -o " + libraryFileName + " " + objectFileName;
  84                 linkerCheck = linkerPath + " -v";
  85                 break;
  86             case "SunOS":
  87                 if (name.endsWith(".so")) {
  88                     objectFileName = name.substring(0, name.length() - ".so".length());
  89                 }
  90                 objectFileName = objectFileName + ".o";
  91                 linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
  92                 linkerCmd = linkerPath + " -shared -o " + libraryFileName + " " + objectFileName;
  93                 linkerCheck = linkerPath + " -V";
  94                 break;
  95             case "Mac OS X":
  96                 if (name.endsWith(".dylib")) {
  97                     objectFileName = name.substring(0, name.length() - ".dylib".length());
  98                 }
  99                 objectFileName = objectFileName + ".o";
 100                 linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
 101                 linkerCmd = linkerPath + " -dylib -o " + libraryFileName + " " + objectFileName;
 102                 linkerCheck = linkerPath + " -v";
 103                 break;
 104             default:
 105                 if (options.osName.startsWith("Windows")) {
 106                     if (name.endsWith(".dll")) {
 107                         objectFileName = name.substring(0, name.length() - ".dll".length());
 108                     }
 109                     objectFileName = objectFileName + ".obj";
 110                     linkerPath = (options.linkerpath != null) ? options.linkerpath : getWindowsLinkPath();
 111                     if (linkerPath == null) {
 112                         throw new InternalError("Can't locate Microsoft Visual Studio amd64 link.exe");
 113                     }
 114                     linkerCmd = linkerPath + " /DLL /OPT:NOREF /NOLOGO /NOENTRY" + " /OUT:" + libraryFileName + " " + objectFileName;




  66         String name = options.outputName;
  67         objectFileName = name;
  68         libraryFileName = name;
  69 
  70         if (options.linkerpath != null && !(new File(options.linkerpath).exists())) {
  71             throw new InternalError("Invalid linker path: " + options.linkerpath);
  72         }
  73         String linkerPath;
  74         String linkerCheck;
  75 
  76         switch (options.osName) {
  77             case "Linux":
  78                 if (name.endsWith(".so")) {
  79                     objectFileName = name.substring(0, name.length() - ".so".length());
  80                 }
  81                 objectFileName = objectFileName + ".o";
  82                 linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
  83                 linkerCmd = linkerPath + " -shared -z noexecstack -o " + libraryFileName + " " + objectFileName;
  84                 linkerCheck = linkerPath + " -v";
  85                 break;









  86             case "Mac OS X":
  87                 if (name.endsWith(".dylib")) {
  88                     objectFileName = name.substring(0, name.length() - ".dylib".length());
  89                 }
  90                 objectFileName = objectFileName + ".o";
  91                 linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
  92                 linkerCmd = linkerPath + " -dylib -o " + libraryFileName + " " + objectFileName;
  93                 linkerCheck = linkerPath + " -v";
  94                 break;
  95             default:
  96                 if (options.osName.startsWith("Windows")) {
  97                     if (name.endsWith(".dll")) {
  98                         objectFileName = name.substring(0, name.length() - ".dll".length());
  99                     }
 100                     objectFileName = objectFileName + ".obj";
 101                     linkerPath = (options.linkerpath != null) ? options.linkerpath : getWindowsLinkPath();
 102                     if (linkerPath == null) {
 103                         throw new InternalError("Can't locate Microsoft Visual Studio amd64 link.exe");
 104                     }
 105                     linkerCmd = linkerPath + " /DLL /OPT:NOREF /NOLOGO /NOENTRY" + " /OUT:" + libraryFileName + " " + objectFileName;


< prev index next >