Porting Swift to Linux aarch64 (arm64)


(Dmitri Gribenko) #1

Hi,

This weekend I have been playing with Swift on Linux on 64-bit arm. I
have summarized my findings in this bug:

https://bugs.swift.org/browse/SR-221

TL;DR: 20 tests fail in the main testsuite; there is an issue with
type metadata, I'm thinking this is a linker issue.

If someone would like to investigate further -- especially if you are
familiar with the internals of the binutils linker -- your help would
be much appreciated!

Dmitri

···

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(William Dillon) #2

I’m on a limb here, but is it possible that the gold linker is causing issues, or is it required?

- Will

···

On Dec 13, 2015, at 11:45 PM, Dmitri Gribenko via swift-dev <swift-dev@swift.org> wrote:

Hi,

This weekend I have been playing with Swift on Linux on 64-bit arm. I
have summarized my findings in this bug:

https://bugs.swift.org/browse/SR-221

TL;DR: 20 tests fail in the main testsuite; there is an issue with
type metadata, I'm thinking this is a linker issue.

If someone would like to investigate further -- especially if you are
familiar with the internals of the binutils linker -- your help would
be much appreciated!

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Dmitri Gribenko) #3

Hi Will,

I was using the binutils linker, not the gold one.

Dmitri

···

On Mon, Dec 14, 2015 at 2:19 PM, William Dillon <william@housedillon.com> wrote:

I’m on a limb here, but is it possible that the gold linker is causing issues, or is it required?

- Will

On Dec 13, 2015, at 11:45 PM, Dmitri Gribenko via swift-dev <swift-dev@swift.org> wrote:

Hi,

This weekend I have been playing with Swift on Linux on 64-bit arm. I
have summarized my findings in this bug:

https://bugs.swift.org/browse/SR-221

TL;DR: 20 tests fail in the main testsuite; there is an issue with
type metadata, I'm thinking this is a linker issue.

If someone would like to investigate further -- especially if you are
familiar with the internals of the binutils linker -- your help would
be much appreciated!

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(William Dillon) #4

Thanks Dmitri,

I’ve been reading cmake files all day, and noticing that some references to the gold linker (specifically this one in cmake/modules/AddSwift):

1058 # Handle gold linker flags for shared libraries.
1059 if(SWIFT_ENABLE_GOLD_LINKER AND SWIFTLIB_SINGLE_SHARED)
1060 if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "LINUX")
1061 # Extend the link_flags for the gold linker so long as this
1062 # isn't the standard library. The standard library uses a
1063 # linker script that isn't supported by the gold linker.
1064 if(NOT SWIFTLIB_SINGLE_IS_STDLIB)
1065 list(APPEND link_flags "-fuse-ld=gold")
1066 endif()
1067 endif()
1068 endif()

imply that there are/may be issues with the gold linker. But, if you’re not using it… :slight_smile:

Anyway, I’ll keep digging.

- Will

···

On Dec 14, 2015, at 2:25 PM, Dmitri Gribenko <gribozavr@gmail.com> wrote:

Hi Will,

I was using the binutils linker, not the gold one.

Dmitri

On Mon, Dec 14, 2015 at 2:19 PM, William Dillon <william@housedillon.com> wrote:

I’m on a limb here, but is it possible that the gold linker is causing issues, or is it required?

- Will

On Dec 13, 2015, at 11:45 PM, Dmitri Gribenko via swift-dev <swift-dev@swift.org> wrote:

Hi,

This weekend I have been playing with Swift on Linux on 64-bit arm. I
have summarized my findings in this bug:

https://bugs.swift.org/browse/SR-221

TL;DR: 20 tests fail in the main testsuite; there is an issue with
type metadata, I'm thinking this is a linker issue.

If someone would like to investigate further -- especially if you are
familiar with the internals of the binutils linker -- your help would
be much appreciated!

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(Dmitri Gribenko) #5

Thanks Dmitri,

I’ve been reading cmake files all day, and noticing that some references to
the gold linker (specifically this one in cmake/modules/AddSwift):

1058 # Handle gold linker flags for shared libraries.
1059 if(SWIFT_ENABLE_GOLD_LINKER AND SWIFTLIB_SINGLE_SHARED)
1060 if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "LINUX")
1061 # Extend the link_flags for the gold linker so long as this
1062 # isn't the standard library. The standard library uses a
1063 # linker script that isn't supported by the gold linker.
1064 if(NOT SWIFTLIB_SINGLE_IS_STDLIB)
1065 list(APPEND link_flags "-fuse-ld=gold")
1066 endif()
1067 endif()
1068 endif()

imply that there are/may be issues with the gold linker. But, if you’re not
using it… :slight_smile:

Yes, it is possible to use by requesting it with a build-script option
(--use-gold-linker), but I haven't been using it in this test.

Anyway, I’ll keep digging.

Thanks!

Dmitri

···

On Mon, Dec 14, 2015 at 3:16 PM, William Dillon <william@housedillon.com> wrote:

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/