Skip to content
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

Using String in Embedded Swift mode reports missing symbols when using Strings as keys to dictionaries #75678

Open
phausler opened this issue Aug 4, 2024 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. embedded Embedded Swift

Comments

@phausler
Copy link
Contributor

phausler commented Aug 4, 2024

Description

Using String as a key to a dictionary results in missing symbols with no explained way to resolve:

ld.lld: error: undefined hidden symbol: _swift_stdlib_getNormData
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss16_StringGutsSliceV17_withNFCCodeUnitsyyys5UInt8VKXEKF)
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFDNormalizerV7_resume9consumingAB6ScalarV6scalar_AB9_NormDataV04normH0tSgAHSgyXE_tF)
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFDNormalizerV13decomposeSlow33_B136021ACF5AAEFA178D70CE67C7EEF0LLyyAB6ScalarV6scalar_AB9_NormDataV04normO0t_tF)
>>> referenced 6 more times

ld.lld: error: undefined hidden symbol: _swift_stdlib_getComposition
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFCNormalizerV7_resume12consumingNFDAB6ScalarVSgAH6scalar_AB9_NormDataV04normI0tSgADzXE_tF)
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFCNormalizerV7_resume12consumingNFDAB6ScalarVSgAH6scalar_AB9_NormDataV04normI0tSgADzXE_tF)
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFCNormalizerV7_resume12consumingNFDAB6ScalarVSgAH6scalar_AB9_NormDataV04normI0tSgADzXE_tF.110)
>>> referenced 1 more times

ld.lld: error: undefined hidden symbol: _swift_stdlib_getDecompositionEntry
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFDNormalizerV13decomposeSlow33_B136021ACF5AAEFA178D70CE67C7EEF0LLyyAB6ScalarV6scalar_AB9_NormDataV04normO0t_tF)

ld.lld: error: undefined hidden symbol: _swift_stdlib_nfd_decompositions
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFDNormalizerV13decomposeSlow33_B136021ACF5AAEFA178D70CE67C7EEF0LLyyAB6ScalarV6scalar_AB9_NormDataV04normO0t_tF)
>>> referenced by ld-temp.o
>>>               lto.tmp:($ss7UnicodeO14_NFDNormalizerV13decomposeSlow33_B136021ACF5AAEFA178D70CE67C7EEF0LLyyAB6ScalarV6scalar_AB9_NormDataV04normO0t_tF)

Reproduction

var table: [String: Int] = [:]
table["foo"] = 1382

Expected behavior

at least there should be some description on how to link the NFD/NFC tables

Environment

Swift version 6.0-dev (LLVM 4ee06774aa7ace9, Swift 2944529)
Target: aarch64-none-none-elf

Additional information

No response

@phausler phausler added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Aug 4, 2024
@hborla hborla added embedded Embedded Swift and removed triage needed This issue needs more specific labels labels Aug 6, 2024
@oleksandr-kosylov
Copy link

+1
using Visual Studio Code + CMake 3.31.0, can't find a way to link tables.a

When I explicitly use ld - looks like ld doesn't know anything about riscv32-none-none-eabi arch (in my case).

@oleksandr-kosylov
Copy link

oleksandr-kosylov commented Nov 21, 2024

Here is how I workarounded the problem:

I added sources into my project so symbols got built within main target.
Here is a list of files I used:

Headers

  1. CaseData.h
  2. GraphemeData.h
  3. NormalizationData.h
  4. ScalarPropsData.h
  5. ScriptData.h
  6. SwiftStdbool.h
  7. SwiftStdint.h
  8. UnicodeData.h

Sources

  1. UnicodeData.cpp
  2. UnicodeGrapheme.cpp
  3. UnicodeNormalization.cpp
  4. UnicodeScalarProps.cpp

You may want to update/remove swift-specific macro in sources, but it's shouldn't be a problem.
So finally I've got string APIs working on esp32-riskv.

CC @phausler

Hope this helps.
Thanks!

@nonameplum
Copy link

@oleksandr-kosylov could you give more insights? From where you got *.cpp files and where have you put *.h files and *.cpp files?

@oleksandr-kosylov
Copy link

oleksandr-kosylov commented Dec 20, 2024

Hello @nonameplum , I used sources from official swift repo - https://github.com/swiftlang/swift.
I've added cpps as sources in CMakeLists and finally included .h files into bridging header file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. embedded Embedded Swift
Projects
None yet
Development

No branches or pull requests

5 participants