strange error when running jtreg tests
Tiago Daitx
tiago.daitx at canonical.com
Tue Aug 23 20:39:58 UTC 2016
Gustavo brought this issue to my attention (thanks!)
The cause is that Debian/Ubuntu have been setting -Wl,--as-needed for
a long while [1], thus libraries must appear *after* objects referring
to the library.
Also, make does state that libraries shouldn't be added to LDFLAGS [2].
Regards,
Tiago
[1] https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed
[2] search for LDFLAGS @
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
On Thu, Aug 18, 2016 at 7:50 AM, David Holmes <david.holmes at oracle.com> wrote:
> Hi Erik,
>
> On 18/08/2016 6:11 PM, Erik Joelsson wrote:
>>
>> Thank you,
>>
>> Here is a request for review on that change.
>>
>> Webrev: http://cr.openjdk.java.net/~erikj/8164297/webrev.01/
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8164297
>
>
> Fix seems to work, as reported, but why do we have:
>
> BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_* := -ljvm ...
>
> yet:
>
> BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_* := -lc
>
> ? Shouldn't they both be _LIBS ?
>
> Thanks,
> David
>
>
>> I will push this to jdk9/hs when reviewed unless anyone thinks it
>> belongs better somewhere else.
>>
>> /Erik
>>
>> On 2016-08-17 19:56, Gustavo Romero wrote:
>>>
>>> Hi Erik,
>>>
>>> On 17-08-2016 12:23, Erik Joelsson wrote:
>>>>
>>>> I'm sorry, you also need this patch, which I for some reason I can't
>>>> remember had in my local forest.
>>>>
>>>> diff -r a24702d4d5ab make/common/TestFilesCompilation.gmk
>>>> --- a/make/common/TestFilesCompilation.gmk
>>>> +++ b/make/common/TestFilesCompilation.gmk
>>>> @@ -86,6 +86,7 @@
>>>> LANG := C, \
>>>> CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$($1_PREFIX)$$(name)), \
>>>> LDFLAGS := $$($1_LDFLAGS)
>>>> $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
>>>> + LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \
>>>> OPTIMIZATION := LOW, \
>>>> )) \
>>>> $$(eval $1 += $$(BUILD_TEST_$$(name)) ) \
>>>>
>>>> /Erik
>>>>
>>>> On 2016-08-17 16:56, Gustavo Romero wrote:
>>>>>
>>>>> Hi Erik,
>>>>>
>>>>> I applied your change:
>>>>>
>>>>> diff -r 397565766eb4 make/test/JtregNative.gmk
>>>>> --- a/make/test/JtregNative.gmk Thu Aug 11 16:22:08 2016 -0700
>>>>> +++ b/make/test/JtregNative.gmk Wed Aug 17 09:54:20 2016 -0500
>>>>> @@ -79,7 +79,7 @@
>>>>> ifeq ($(OPENJDK_TARGET_OS), linux)
>>>>> BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z
>>>>> noexecstack
>>>>> BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z
>>>>> execstack
>>>>> - BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm
>>>>> -lpthread
>>>>> + BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread
>>>>> BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE
>>>>> endif
>>>>>
>>>>>
>>>>> but it seems the new param is not passed to the linker now. So it
>>>>> failed.
>>>>>
>>> I confirm that your patch fixes the issue on Ubuntu 16.04 PPC64 &&
>>> x64, applying
>>> cleanly to:
>>>
>>> http://hg.openjdk.java.net/jdk9/hs-comp, 37de4195dd18+ tip:
>>>
>>> diff -r 37de4195dd18 make/common/TestFilesCompilation.gmk
>>> --- a/make/common/TestFilesCompilation.gmk Fri Aug 05 09:50:23
>>> 2016 -0700
>>> +++ b/make/common/TestFilesCompilation.gmk Wed Aug 17 13:54:43
>>> 2016 -0400
>>> @@ -86,6 +86,7 @@
>>> LANG := C, \
>>> CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$($1_PREFIX)$$(name)), \
>>> LDFLAGS := $$($1_LDFLAGS)
>>> $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
>>> + LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \
>>> OPTIMIZATION := LOW, \
>>> )) \
>>> $$(eval $1 += $$(BUILD_TEST_$$(name)) ) \
>>>
>>>
>>> http://hg.openjdk.java.net/jdk9/hs-comp/hotspot, 031f53ef620a+ tip:
>>>
>>> diff -r 031f53ef620a make/test/JtregNative.gmk
>>> --- a/make/test/JtregNative.gmk Wed Aug 17 06:23:04 2016 +0000
>>> +++ b/make/test/JtregNative.gmk Wed Aug 17 13:54:58 2016 -0400
>>> @@ -79,7 +79,7 @@
>>> ifeq ($(OPENJDK_TARGET_OS), linux)
>>> BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack
>>> BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
>>> - BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread
>>> + BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread
>>> BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE
>>> endif
>>>
>>> Thank you very much for having a look.
>>>
>>> Kind regards,
>>> Gustavo
>>>
>>>
>>
>
--
Tiago Stürmer Daitx
Software Engineer
tiago.daitx at canonical.com
PGP Key: 4096R/F5B213BE (hkp://keyserver.ubuntu.com)
Fingerprint = 45D0 FE5A 8109 1E91 866E 8CA4 1931 8D5E F5B2 13BE
More information about the build-dev
mailing list