If my understanding is correct (and I may well be wrong!) contributing the 
patch back in to binutils is most likely a no go - binutils itself builds fine 
on Mac OS because all the targets are executables, but hsdis is a dynamic 
library:

Quote from 'man environ':
    Shared libraries and bundles don't have direct access to environ, which is 
only available to the loader
     ld(1) when a complete program is being linked.  The environment routines 
can still be used, but if
     direct access to environ is needed, the _NSGetEnviron() routine, defined 
in <crt_externs.h>, can be
     used to retrieve the address of environ at runtime.

Here are the changes I made to solve this in patch form in any case:


Hope this helps,

Chris


On Apr 21, 2012, at 7:33 AM, Henri Gomez wrote:

> Could you contribute this patch ?
> 
> For binutils, i'll check with stock and MacPorts versions.  
> 
> Le 20 avr. 2012 à 19:57, Chris Dennis <[email protected]> a écrit :
> 
>> The last time I tried this you needed to patch binutils on Mac OS because of 
>> the tighter restrictions on accessing "environ".
>> 
>> You'll need to do something like this (I forget where it's used):
>> 
>> #ifdef __APPLE__
>> #include <crt_externs.h>
>> #define environ (*_NSGetEnviron())
>> #endif
>> 
>> On Apr 20, 2012, at 1:42 PM, Volker Simonis wrote:
>> 
>>> Actually there is no.
>>> 
>>> But it's very easy to build hsdis - it's just one .c and one .h file.
>>> You just need to build binutils for your platform first (.configure;
>>> make) and than compile and link hsdis.c against libbfd.a, libopcodes.a
>>> and libiberty.a from binutils.
>>> This all can easily be done manually with just a few commands but it
>>> would be of course much better if you could provide a patch for the
>>> Makefile:)
>>> 
>>> 
>>> On Fri, Apr 20, 2012 at 6:52 PM, Henri Gomez <[email protected]> wrote:
>>>> I'll look into build logs (thanks Jenkins)
>>>> 
>>>> BTW, I didn't see OSX or Darwin support into hsdis Makefile.
>>>> 
>>>> Le 20 avr. 2012 à 17:08, Volker Simonis <[email protected]> a écrit 
>>>> :
>>>> 
>>>>> Somehow you managed to build a "fastdebug" JDK with a still optimized
>>>>> HotSpot VM:
>>>>> 
>>>>> OpenJDK 64-Bit Server VM (build 24.0-b04, mixed mode)
>>>>> 
>>>>> For -XX:+PrintOptoAssembly to work, you need a debug or fastdebug VM:
>>>>> 
>>>>> OpenJDK 64-Bit Server VM (build 22.0-b01-internal-jvmg, mixed mode)
>>>>> 
>>>>> You can easily build it from hotspot/src/make with these commands
>>>>> 
>>>>> ALT_BOOTDIR=<java_7_directory>
>>>>> ALT_OUTPUTDIR=<your_favourite_output_dir> make jvmg
>>>>> ALT_BOOTDIR=<java_7_directory>
>>>>> ALT_OUTPUTDIR=<your_favourite_output_dir> make fastdebug
>>>>> 
>>>>> for the debug and fastdebug case.
>>>>> 
>>>>> Or you can try to find out why SKIP_FASTDEBUG_BUILD=false hasn't been
>>>>> properly propagated into the HotSpot make file:)
>>>>> 
>>>>> Regards,
>>>>> Volker
>>>>> 
>>>>> On Fri, Apr 20, 2012 at 1:58 PM, Henri Gomez <[email protected]> 
>>>>> wrote:
>>>>>> Well, it seems my build is not fully debug enabled :
>>>>>> 
>>>>>> java -version -XX:+PrintOptoAssembly
>>>>>> openjdk version "1.8.0-jdk8-b30-x64-lambda-fastdebug"
>>>>>> OpenJDK Runtime Environment (build 
>>>>>> 1.8.0-jdk8-b30-x64-lambda-fastdebug-20120420)
>>>>>> OpenJDK 64-Bit Server VM (build 24.0-b04, mixed mode)
>>>>>> 
>>>>>> ---
>>>>>> 
>>>>>> java -XX:+PrintOptoAssembly
>>>>>> Unrecognized VM option 'PrintOptoAssembly'
>>>>>> Error: Could not create the Java Virtual Machine.
>>>>>> Error: A fatal exception has occurred. Program will exit.
>>>>>> 
>>>>>> ---
>>>>>> 
>>>>>> java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
>>>>>> OpenJDK 64-Bit Server VM warning: PrintAssembly is enabled; turning on
>>>>>> DebugNonSafepoints to gain additional output
>>>>>> Could not load hsdis-amd64.dylib; library not loadable; PrintAssembly
>>>>>> is disabled
>>>>>> Syntaxe : java [-options] class [args...]
>>>>>> 
>>>>>> Hum ;-(
>>>>>> 
>>>>>> 2012/4/20 Remi Forax <[email protected]>:
>>>>>>> Just hsdis, but maybe the one from Graal that use a better assembler 
>>>>>>> syntax.
>>>>>>> 
>>>>>>> Rémi
>>>>>>> 
>>>>>>> Sent from my Phone
>>>>>>> 
>>>>>>> ----- Reply message -----
>>>>>>> From: "Krystal Mok" <[email protected]>
>>>>>>> To: "Remi Forax" <[email protected]>
>>>>>>> Cc: <[email protected]>
>>>>>>> Subject: OpenJDK 8 and fastdebug
>>>>>>> Date: Fri, Apr 20, 2012 09:44
>>>>>>> I see. That makes sense.BTW, is it hsdis, or is there a new 
>>>>>>> disassembler plugin?
>>>>>>> 
>>>>>>> - Kris
>>>>>>> 
>>>>>>> On Fri, Apr 20, 2012 at 3:35 PM, Remi Forax <[email protected]> wrote:
>>>>>>> 
>>>>>>> The idea is to bundle jadis with the fast debug VM.
>>>>>>> 
>>>>>>> Rémi
>>>>>>> 
>>>>>>> Sent from my Phone
>>>>>>> 
>>>>>>> 
>>>>>>> ----- Reply message -----
>>>>>>> From: "Krystal Mok" <[email protected]>
>>>>>>> To: "Rémi Forax" <[email protected]>
>>>>>>> 
>>>>>>> Cc: <[email protected]>
>>>>>>> Subject: OpenJDK 8 and fastdebug
>>>>>>> Date: Fri, Apr 20, 2012 08:55
>>>>>>> 
>>>>>>> 
>>>>>>> PrintAssembly is available in product builds, too. You'll just need to 
>>>>>>> set -XX:+UnlockDiagnosticVMOptions before setting -XX:+PrintAssembly.
>>>>>>> 
>>>>>>> On the other hand, -XX:+PrintOptoAssembly is only available in a debug 
>>>>>>> build.
>>>>>>> 
>>>>>>> - Kris
>>>>>>> 
>>>>>>> On Fri, Apr 20, 2012 at 2:00 PM, Rémi Forax <[email protected]> wrote:
>>>>>>> 
>>>>>>> 
>>>>>>> On 04/20/2012 07:28 AM, Henri Gomez wrote:
>>>>>>> 
>>>>>>> 
>>>>>>> Just set
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> SKIP_FASTDEBUG_BUILD=false
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> (I don't know what role DEBUG_NAME plays)
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Relative question, how can I check a java exec is in fastdebug mode ?
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Check "java -version", it will show it is fastdebug.
>>>>>>> 
>>>>>>> 
>>>>>>> It seems good 
>>>>>>> (http://openjdk-osx-build.googlecode.com/files/OpenJDK-OSX-8-x64-lambda-fastdebug-jdk-b30-20120420.dmg)
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> openjdk version "1.8.0-jdk8-b30-x64-lambda-fastdebug"
>>>>>>> 
>>>>>>> OpenJDK Runtime Environment (build 
>>>>>>> 1.8.0-jdk8-b30-x64-lambda-fastdebug-20120420)
>>>>>>> 
>>>>>>> OpenJDK 64-Bit Server VM (build 24.0-b04, mixed mode)
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Many thanks, Henry,
>>>>>>> 
>>>>>>> now people can use -XX:+PrintAssembly :)
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Rémi
>> 

Reply via email to