-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better support for PIC #191
Comments
There are issues building mlton on 64-bit Arch Linux. Even when setting
I tried:
What I want to achieve is to update the official |
Have you tried the very latest commit (#190)? Prior to that commit, the amd64 codegen would not generate position independent code for Linux. And, this really is the limitation of trying to determine the PI/non-PI for the target based on the architecture/os pair. As I understand it, systems (the default behavior of the c compiler and of the linker) can be configured in many different ways. In particular, whether the default for the c compiler is to generate PIC or not and whether the linker accepts (either silently or with a non-fatal warning) mixing of PIC and non-PIC code. I think that the default on some Linux distributions (Ubuntu and Fedora) is for gcc to generate PIC, but the linker will silently allow non-PIC object files to be linked into an executable (and the resulting executable will not be PI); that's the scenario that allows MLton generated executables on those systems to work before and after merging #190. Maybe Arch is different and the linker is generating a fatal error when linking non-PIC object files into an executable; in which case, you might get a different behavior after merging #190. You might also make progress by forcing the use of the C codegen, which would have the intermediate object files created according to the default gcc behavior. You could try |
@xyproto it is possible to bootstrap MLton with SML-NJ. I am trying to do so now. (compilation takes a while). Here is what I've done so far:
Background info:
|
@xyproto here is a patch for your PKGBUILD. (though it won't work if
|
Thank you @mkoloberdin! I will try compiling with smlnj. |
@xyproto this approach seems to be working. I've compiled mlton this way successfully. Then compiled Ur/Web with it. ( https://aur.archlinux.org/packages/urweb/ ) |
@mkoloberdin It worked. Released new packages to [community]. Thanks! |
@xyproto Great! You might want to do the following as well as I have mentioned above (so that when you upgrade the package next time you do not forget to remove the now unnecessary smlnj dependency/bootstrapping):
Also, you've got my email wrong. If you have to add it, pull it from the maintainer line here: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=urweb |
Thanks, I will consider commenting out the lines related to smlnj (might come in handy next time there is a binary incompatible upgrade). I'll also update your e-mail. |
@mkoloberdin @xyproto Some comments:
You might try the following sequence:
|
@mkoloberdin Updated your e-mail address. Updated the Arch Linux mlton package to only build with the previous version of mlton that was boostrapped with smlnj. There does not seem to be any PIC related issues with mlton on x86_64 on Arch Linux anymore. 👍 |
Updates to `make runtime` Highlights: * Use proper Makefile rules for `/runtime/gen/sizes`, `/runtime/gen/ml-types.h`, `/runtime/gen/c-types.{h,sml}`, and `/runtime/gen/basis-ffi.{h,sml}`, making the generator executables a dependency, updating the generator programs to emit each file separately (according to program argument), and eliminating the use of `.stamp` files (45041d9, 36494b0, ac1651a, 6a37cc3). * Avoid building `runtime/gen/basis-ffi.{h,sml}` with clean sources (76da64c). * Use automatic dependencies via `cc -MM` and `.d`-files (eeee00f). * Add and use `WITH_{DBG,PIC}_RUNTIME` in `runtime/Makefile` (18c6f0c). * Build with `WITH_DBG_RUNTIME=false` in `./bin/travis-ci` (84d4861). * Copy `%-pic.a` from `%.a` when PIC enabled by default (a864e2c). The last two, in particular, allow TravisCI to only build one variant of the runtime, rather than 3. The goal had been to bring some order to `runtime/Makefile` and potentially better understand how to handle non-PI vs PIC vs PIE (see #191).
Can be used to override a platform-determined default. See MLton#191
Can be used to override a target-determined default. See MLton#191
Can be used to override a target-determined default. Also, remove `-pic-runtime {false|true}` option. See MLton#191
There are a number of short- and long-term improvements to better support PIC:
-native-pic {false,true}
compile-time optionThe text was updated successfully, but these errors were encountered: