Re: [Libreoffice] ld dynamic linker hash style
On Tue, Apr 05, 2011 at 09:02:48PM +0200, Francois Tigeot wrote: On Tue, Apr 05, 2011 at 02:28:40PM +0200, Petr Mladek wrote: On Tue, Apr 05, 2011 at 11:53:55AM +0100, Michael Meeks wrote: I guess it might be a good idea to default to 'auto' for hash-style, and compile and link a small test program with that, defaulting to 'gnu' if that is supported, and no flag if not. Francois, would you be able to cook up something, please? If it is enough to use AC_TRY_RUN, you might find some samples in bootstrap/configure.in. Here's a first patch to add a check if the build machine can run --hash-style=gnu binaries. I still have to find a way to link this check to the AC_ARG_WITH section. -- Francois Tigeot diff --git a/configure.in b/configure.in index 50ea5e1..0904fdf 100755 --- a/configure.in +++ b/configure.in @@ -957,8 +957,13 @@ AC_ARG_WITH(system-mozilla, WITH_SYSTEM_MOZILLA=no) AC_ARG_WITH(linker-hash-style, -[ --with-linker-hash-style -], WITH_LINKER_HASH_STYLE=$withval, WITH_LINKER_HASH_STYLE=gnu) + AS_HELP_STRING([--with-linker-hash-style], + [Tells the linker to use --hash-style=choice when linking shared + objects. choice can be one of sysv, gnu, or both, the default + beeing gnu if it is supported on the build system, and sysv + otherwise.]), + WITH_LINKER_HASH_STYLE=$withval, + WITH_LINKER_HASH_STYLE=gnu) AC_ARG_WITH(stlport, AS_HELP_STRING([--with-stlport], @@ -2825,6 +2830,26 @@ fi AC_SUBST(HAVE_CXX0X) +dnl === +dnl Test whether programs linked with --hash-style=gnu can be run +dnl === +AC_MSG_CHECKING([whether programs linked with --hash-style=gnu can be run]) + +save_CFLAGS=$CFLAGS +CFLAGS=-Wl,--hash-style=gnu + +AC_TRY_RUN([ +int main(char argc, char** argv) { + return 0; +} +], HAVE_HSGNU_SUPPORT=TRUE,AC_MSG_RESULT([no])) + +CFLAGS=$save_CFLAGS +if test $HAVE_HSGNU_SUPPORT = TRUE; then + AC_MSG_RESULT([yes]) +fi +AC_SUBST(HAVE_HSGNU_SUPPORT) + # === # use --ccache-skip? # === ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Francois Tigeot píše v St 06. 04. 2011 v 11:25 +0200: On Tue, Apr 05, 2011 at 09:02:48PM +0200, Francois Tigeot wrote: On Tue, Apr 05, 2011 at 02:28:40PM +0200, Petr Mladek wrote: On Tue, Apr 05, 2011 at 11:53:55AM +0100, Michael Meeks wrote: I guess it might be a good idea to default to 'auto' for hash-style, and compile and link a small test program with that, defaulting to 'gnu' if that is supported, and no flag if not. Francois, would you be able to cook up something, please? If it is enough to use AC_TRY_RUN, you might find some samples in bootstrap/configure.in. Here's a first patch to add a check if the build machine can run --hash-style=gnu binaries. I still have to find a way to link this check to the AC_ARG_WITH section. It was a good start. I think that it would be confusing to integrate it to the AC_ARG_WITH section. These sections are usually pretty simple. All the more complex tests are done later in configure.in. I have found that there already was a check for --hash-style. So, I used your draft and itegrated it into the existing test, see http://cgit.freedesktop.org/libreoffice/bootstrap/commit/?h=libreoffice-3-4id=34e8665b5d3544c48086701d9f758ef0b9d900f8 It seems to work here. I hope that it will work for you as well. Please, do not feel offended that I did not use your patch as is. The patch was nice but needed more love. I did not want to bother you too much. Best Regards, Petr ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
On Wed, Apr 06, 2011 at 03:59:34PM +0200, Petr Mladek wrote: I have found that there already was a check for --hash-style. So, I used your draft and itegrated it into the existing test, see http://cgit.freedesktop.org/libreoffice/bootstrap/commit/?h=libreoffice-3-4id=34e8665b5d3544c48086701d9f758ef0b9d900f8 Er, wrong move :-( Please, do not feel offended that I did not use your patch as is. The patch was nice but needed more love. I'm well aware of that, I'm no autoconf specialist and it was a work-in-progress. Let me be offended on a different point ;-) the test you have reused and the one I just wrote are for two different things. We have two things here: - the first check tested for --hash-style=gnu option support. ld supports it, result = yes - the check I just wrote tested if binaries linked with the --hash-style=gnu can be run something in the system doesn't grok it, result = no By integrating the two autoconf checks, we're back to a situation where the build process happily links binaries with --hash-style=gnu and crashes a few moments later trying to run them. What I wanted to do is set a reasonable default of gnu or sysv for the --with-hash-style option depending if the machine can run such binaries or not. -- Francois Tigeot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Francois Tigeot píše v St 06. 04. 2011 v 17:04 +0200: On Wed, Apr 06, 2011 at 03:59:34PM +0200, Petr Mladek wrote: I have found that there already was a check for --hash-style. So, I used your draft and itegrated it into the existing test, see http://cgit.freedesktop.org/libreoffice/bootstrap/commit/?h=libreoffice-3-4id=34e8665b5d3544c48086701d9f758ef0b9d900f8 Er, wrong move :-( Please, do not feel offended that I did not use your patch as is. The patch was nice but needed more love. I'm well aware of that, I'm no autoconf specialist and it was a work-in-progress. Let me be offended on a different point ;-) the test you have reused and the one I just wrote are for two different things. We have two things here: - the first check tested for --hash-style=gnu option support. ld supports it, result = yes If you look at my change, I have removed this check. IMHO, it is obsoleted by the AC_TRY_RUN one. ;-) AC_TRY_LINK compiles and links the program. AC_TRY_RUN compiles, links, and run the program. IMHO, it does not make sense to enable --hash-style=gnu if the application can be linked and not started on the given system. So, the AC_TRY_LINK is not needed because the same success/failure is detected also by AC_TRY_RUN. - the check I just wrote tested if binaries linked with the --hash-style=gnu can be run something in the system doesn't grok it, result = no By integrating the two autoconf checks, we're back to a situation where the build process happily links binaries with --hash-style=gnu and crashes a few moments later trying to run them. Are you sure? Have you looked at my changes? :-) What I wanted to do is set a reasonable default of gnu or sysv for the --with-hash-style option depending if the machine can run such binaries or not. I hope that I did the same. The only difference might be that my approach does not care only about the default. In addition, it does not allow to force gnu on systems that are able to link but are not able to run such programs. IMHO, it does not make much sense. It would even cause compilation problems because some helper tools need are compiled and ran during build. Or did I miss anything? Best Regards, Petr ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
On Wed, Apr 06, 2011 at 05:45:39PM +0200, Petr Mladek wrote: Francois Tigeot píše v St 06. 04. 2011 v 17:04 +0200: the test you have reused and the one I just wrote are for two different things. We have two things here: - the first check tested for --hash-style=gnu option support. ld supports it, result = yes If you look at my change, I have removed this check. IMHO, it is obsoleted by the AC_TRY_RUN one. ;-) IMHO, it does not make sense to enable --hash-style=gnu if the application can be linked and not started on the given system. So, the AC_TRY_LINK is not needed because the same success/failure is detected also by AC_TRY_RUN. Okay, I understand the logic. - the check I just wrote tested if binaries linked with the --hash-style=gnu can be run something in the system doesn't grok it, result = no By integrating the two autoconf checks, we're back to a situation where the build process happily links binaries with --hash-style=gnu and crashes a few moments later trying to run them. Are you sure? Have you looked at my changes? :-) I admit I only have taken a cursory look to the patch itself. Howewer, I've also updated my git repository and tried to build LibreOffice. The build failed exactly as I described it above. What I wanted to do is set a reasonable default of gnu or sysv for the --with-hash-style option depending if the machine can run such binaries or not. I hope that I did the same. config.log says HAVE_LD_HASH_STYLE='TRUE' and yet my system can not run the newly generated makedepend. The only difference might be that my approach does not care only about the default. In addition, it does not allow to force gnu on systems that are able to link but are not able to run such programs. IMHO, it does not make much sense. I preferred not to assume too much on this point and allow some foot shooting. It would even cause compilation problems because some helper tools need are compiled and ran during build. Or did I miss anything? Yeah, that's exactly why my builds are failing :-( -- Francois Tigeot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Francois Tigeot píše v St 06. 04. 2011 v 18:01 +0200: On Wed, Apr 06, 2011 at 05:45:39PM +0200, Petr Mladek wrote: Francois Tigeot píše v St 06. 04. 2011 v 17:04 +0200: the test you have reused and the one I just wrote are for two different things. We have two things here: - the first check tested for --hash-style=gnu option support. ld supports it, result = yes If you look at my change, I have removed this check. IMHO, it is obsoleted by the AC_TRY_RUN one. ;-) IMHO, it does not make sense to enable --hash-style=gnu if the application can be linked and not started on the given system. So, the AC_TRY_LINK is not needed because the same success/failure is detected also by AC_TRY_RUN. Okay, I understand the logic. - the check I just wrote tested if binaries linked with the --hash-style=gnu can be run something in the system doesn't grok it, result = no By integrating the two autoconf checks, we're back to a situation where the build process happily links binaries with --hash-style=gnu and crashes a few moments later trying to run them. Are you sure? Have you looked at my changes? :-) I admit I only have taken a cursory look to the patch itself. Howewer, I've also updated my git repository and tried to build LibreOffice. The build failed exactly as I described it above. Ah, are you using git master? I have initially committed the fix only to the libreoffice-3-4 branch :-( I have just cherry-picked it for master as well. Could you please try once again? What I wanted to do is set a reasonable default of gnu or sysv for the --with-hash-style option depending if the machine can run such binaries or not. I hope that I did the same. config.log says HAVE_LD_HASH_STYLE='TRUE' and yet my system can not run the newly generated makedepend. If it is not the problem with master, could you please try the attached test? Just do: gcc -Wl,--hash-style=gnu test-link-hash.c ./a.out I wonder if such a trivial program fails at runtime. It is possible that we would need a more complicated test. The only difference might be that my approach does not care only about the default. In addition, it does not allow to force gnu on systems that are able to link but are not able to run such programs. IMHO, it does not make much sense. I preferred not to assume too much on this point and allow some foot shooting. ;-) It would even cause compilation problems because some helper tools need are compiled and ran during build. Or did I miss anything? Yeah, that's exactly why my builds are failing :-( Sure, we need to fix it. Best Regards, Petr #include stdio.h int main(char argc, char** argv) { printf (hello world\n); return 0; } ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
On Wed, Apr 06, 2011 at 06:28:47PM +0200, Petr Mladek wrote: Francois Tigeot píše v St 06. 04. 2011 v 18:01 +0200: I admit I only have taken a cursory look to the patch itself. Howewer, I've also updated my git repository and tried to build LibreOffice. The build failed exactly as I described it above. Ah, are you using git master? Yes, I don't dare touch the release branches yet ;-) I have initially committed the fix only to the libreoffice-3-4 branch :-( I have just cherry-picked it for master as well. Could you please try once again? Doh! I should have seen configure.in wasn't updated. My apologies. Now that it is properly patched, the build is nicely chugging along :-) Many thanks for the patch. Kind Regards, -- Francois Tigeot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Francois Tigeot píše v Po 04. 04. 2011 v 22:51 +0200: Hi all, During the last few days, my builds have been broken with this error message: makedepend: Shared object has no run-time symbol table I have tracked the start of my troubles to this commit: 83b781819557f269fda65ce551ec9a008fade511 http://cgit.freedesktop.org/libreoffice/bootstrap/commit/?id=83b781819557f269fda65ce551ec9a008fade511 It adds the --hash-style=gnu string on ld invocations. --hash-style=gnu sets the type of linker's hash tables to a new .gnu.hash format. The problem is, this flag also prevents ld to write classic ELF .hash sections, preventing some systems to be able to run the generated binaries. Googling a bit, I found references to this issue on all types of systems See here for a Suse one: http://mail.openjdk.java.net/pipermail/porters-dev/2009-January/000235.html The new .gnu.hash sections are not recognized by old binutils versions such as 2.17 and may or may not be used on more recent ones. One of my machines is using binutils-2.21 and cannot run binaries linked with the --hash-style=gnu option. I need to investigate. Howewer, the fix is quite simple: replace --hash-style=gnu by --hash-style=both The --hash-style=both option generates both old and new-style sections, keeping all binutils happy. Sounds reasonable. Michael, what is your opinion? Could it cause any regression in the start up speed? Best Regards, Petr ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Hi Francois, On Mon, 2011-04-04 at 22:51 +0200, Francois Tigeot wrote: During the last few days, my builds have been broken with this error message: makedepend: Shared object has no run-time symbol table Oh - that is a downer indeed. What system are you using ? It adds the --hash-style=gnu string on ld invocations. --hash-style=gnu sets the type of linker's hash tables to a new .gnu.hash format. Right - if your gcc supports that, presumably your system library should too [ after all, it is trivial to implement, and a huge speedup for linking ]. The problem is, this flag also prevents ld to write classic ELF .hash sections, preventing some systems to be able to run the generated binaries. Right - because they are big, and there is not much point in dragging all that obsolete bloat around ;-) One of my machines is using binutils-2.21 and cannot run binaries linked with the --hash-style=gnu option. I need to investigate. So - if you want to create binaries to run on other systems, then you need to beware. You will have hideous problems beyond belief, and way beyond just linking issues: glibc symbol versions alone will break almost everything :-) Howewer, the fix is quite simple: replace --hash-style=gnu by --hash-style=both The --hash-style=both option generates both old and new-style sections, keeping all binutils happy. Well - we need to do this for the 'Generic' builds with an explicit =both (cf. distro-configs) so it can run even on ancient systems, but Linux distributions in general should use the --hash-style=gnu if it is present in the toolchain (IMHO). The attached patch does just that. So - I'm really not convinced :-) What system are you compiling on, and/or did you upgrade your gcc/binutils without upgrading glibc ? I guess it might be a good idea to default to 'auto' for hash-style, and compile and link a small test program with that, defaulting to 'gnu' if that is supported, and no flag if not. Should be fairly easy to do that with an AC_TRY_RUN (?). ie. since the win from --hash-style=gnu is fairly huge, I'd like to have this by default wherever possible, --hash-style=both adds some real chunk of data we don't need to the output, so it is not a great default for a fast office suite :-) ATB, Michael. -- michael.me...@novell.com , Pseudo Engineer, itinerant idiot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Hi Michael, On Tue, Apr 05, 2011 at 11:53:55AM +0100, Michael Meeks wrote: On Mon, 2011-04-04 at 22:51 +0200, Francois Tigeot wrote: During the last few days, my builds have been broken with this error message: makedepend: Shared object has no run-time symbol table Oh - that is a downer indeed. What system are you using ? DragonFly. The problem is, this flag also prevents ld to write classic ELF .hash sections, preventing some systems to be able to run the generated binaries. Right - because they are big, and there is not much point in dragging all that obsolete bloat around ;-) Well, if you can't run binaries without it, that's not so obsolete IMO. One of my machines is using binutils-2.21 and cannot run binaries linked with the --hash-style=gnu option. I need to investigate. So - if you want to create binaries to run on other systems, then you need to beware. You will have hideous problems beyond belief, and way beyond just linking issues: glibc symbol versions alone will break almost everything :-) The first step is to have the binaries run on the system they were compiled on. And I'm pretty sure I won't have any trouble with glibc ;-) What I meant to say is even with binutils-2.21, the gnu-hash option doesn't work in all cases. Howewer, the fix is quite simple: replace --hash-style=gnu by --hash-style=both The --hash-style=both option generates both old and new-style sections, keeping all binutils happy. Well - we need to do this for the 'Generic' builds with an explicit =both (cf. distro-configs) so it can run even on ancient systems, but Linux distributions in general should use the --hash-style=gnu if it is present in the toolchain (IMHO). You lost me here: with the last commit, --hash-style=gnu is the default and is not limited to Linux or specific Linux distributions. So - I'm really not convinced :-) What system are you compiling on, and/or did you upgrade your gcc/binutils without upgrading glibc ? System: DragonFly 2.9/x86_64 gcc: 4.4.5 binutils: 2.21 glibc: none Be convinced :) I guess it might be a good idea to default to 'auto' for hash-style, and compile and link a small test program with that, defaulting to 'gnu' if that is supported, and no flag if not. Should be fairly easy to do that with an AC_TRY_RUN (?). That would be *much* better. Cheers, -- Francois Tigeot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
Francois Tigeot píše v Út 05. 04. 2011 v 13:51 +0200: On Tue, Apr 05, 2011 at 11:53:55AM +0100, Michael Meeks wrote: I guess it might be a good idea to default to 'auto' for hash-style, and compile and link a small test program with that, defaulting to 'gnu' if that is supported, and no flag if not. Should be fairly easy to do that with an AC_TRY_RUN (?). That would be *much* better. It sounds like the best solution. Francois, would you be able to cook up something, please? If it is enough to use AC_TRY_RUN, you might find some samples in bootstrap/configure.in. If you want to require a minimal binutils version, you might take inspiration at http://cgit.freedesktop.org/libreoffice/build/tree/patches/dev300/link-as-needed.diff Best Regards, Petr ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] ld dynamic linker hash style
On Tue, Apr 05, 2011 at 02:28:40PM +0200, Petr Mladek wrote: On Tue, Apr 05, 2011 at 11:53:55AM +0100, Michael Meeks wrote: I guess it might be a good idea to default to 'auto' for hash-style, and compile and link a small test program with that, defaulting to 'gnu' if that is supported, and no flag if not. Francois, would you be able to cook up something, please? If it is enough to use AC_TRY_RUN, you might find some samples in bootstrap/configure.in. I'm trying, but I can't figure out how to pass the needed --hash-style=gnu option to the linker :-/ If you want to require a minimal binutils version, you might take inspiration at http://cgit.freedesktop.org/libreoffice/build/tree/patches/dev300/link-as-needed.diff Thanks for the link, but I'm afraid it won't help here. The binutils version is only important when you want to generate ELF files using the new .gnu.hash section; it is of no use when you want to check if a particular system can _run_ them. Kind Regards, -- Francois Tigeot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice