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

DataFlowSanitizer-x86_64 :: custom.cpp: undefined reference to `__isoc23_strtol.dfsan' (and more) #79283

Closed
mgorny opened this issue Jan 24, 2024 · 4 comments · Fixed by #79958

Comments

@mgorny
Copy link
Member

mgorny commented Jan 24, 2024

I'm seeing the following test regression. I haven't bisected it but I suspect it started with 67e0f41 when the test was un-XFAILed. I've reproduced it with 9eb0f86 (Saturday morning) and 543cf08 (today):

FAIL: DataFlowSanitizer-x86_64 :: custom.cpp (2172 of 7003)
******************** TEST 'DataFlowSanitizer-x86_64 :: custom.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt_build/lib/llvm/19/bin/clang  -fsanitize=dataflow  -m64  /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp -o /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt_build/test/dfsan/X86_64Config/Output/custom.cpp.tmp && DFSAN_OPTIONS="strict_data_dependencies=0"  /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt_build/test/dfsan/X86_64Config/Output/custom.cpp.tmp
+ /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt_build/lib/llvm/19/bin/clang -fsanitize=dataflow -m64 /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp -o /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt_build/test/dfsan/X86_64Config/Output/custom.cpp.tmp
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp:2079:11: warning: 'snprintf' will always be truncated; specified size is 19, but format string expands to at least 26 [-Wformat-truncation]
 2079 |   int r = snprintf(buf, 19, "hello %s, %-d/   %d/%d %f", s, y, m, d,
      |           ^
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp:2237:31: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
 2237 |   test_sscanf_chunk((intmax_t)18446744073709551615, "%ju", _buf, 1);
      |                               ^
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp:2241:29: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
 2241 |   test_sscanf_chunk((size_t)18446744073709551615, "%zu", _buf, 1);
      |                             ^
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp:2245:32: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
 2245 |   test_sscanf_chunk((ptrdiff_t)18446744073709551615, "%tu", _buf, 1);
      |                                ^
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/work/compiler-rt/test/dfsan/custom.cpp:2251:38: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
 2251 |   test_sscanf_chunk((char)'z', "%c", "z", 1);
      |                                      ^
5 warnings generated.
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `test_strtol() [clone .dfsan]':
custom.cpp:(.text+0x74a5): undefined reference to `__isoc23_strtol.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x7604): undefined reference to `__isoc23_strtol.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x7725): undefined reference to `__isoc23_strtol.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `test_strtoll() [clone .dfsan]':
custom.cpp:(.text+0x7865): undefined reference to `__isoc23_strtoll.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x79c4): undefined reference to `__isoc23_strtoll.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x7ae5): undefined reference to `__isoc23_strtoll.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `test_strtoul() [clone .dfsan]':
custom.cpp:(.text+0x7c25): undefined reference to `__isoc23_strtoul.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x7d8d): undefined reference to `__isoc23_strtoul.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x7eb4): undefined reference to `__isoc23_strtoul.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `test_strtoull() [clone .dfsan]':
custom.cpp:(.text+0x8005): undefined reference to `__isoc23_strtoull.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x8160): undefined reference to `__isoc23_strtoull.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0x827e): undefined reference to `__isoc23_strtoull.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `test_sscanf() [clone .dfsan]':
custom.cpp:(.text+0xe324): undefined reference to `__isoc23_sscanf.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0xe49d): undefined reference to `__isoc23_sscanf.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: custom.cpp:(.text+0xe932): undefined reference to `__isoc23_sscanf.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `void test_sscanf_chunk<int>(int, char const*, char*, int) [clone .dfsan]':
custom.cpp:(.text._Z17test_sscanf_chunkIiEvT_PKcPci.dfsan[_Z17test_sscanf_chunkIiEvT_PKcPci]+0x325): undefined reference to `__isoc23_sscanf.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o: in function `void test_sscanf_chunk<long>(long, char const*, char*, int) [clone .dfsan]':
custom.cpp:(.text._Z17test_sscanf_chunkIlEvT_PKcPci.dfsan[_Z17test_sscanf_chunkIlEvT_PKcPci]+0x326): undefined reference to `__isoc23_sscanf.dfsan'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-19.0.0.9999/temp/custom-2d641b.o:custom.cpp:(.text._Z17test_sscanf_chunkIcEvT_PKcPci.dfsan[_Z17test_sscanf_chunkIcEvT_PKcPci]+0x324): more undefined references to `__isoc23_sscanf.dfsan' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)

--

********************

This is Gentoo amd64, glibc 2.38-r9.

CC @MaskRay

@thesamesam
Copy link
Member

@tstellar tstellar moved this from Needs Triage to Needs Fix in LLVM Release Status Jan 26, 2024
MaskRay added a commit that referenced this issue Jan 30, 2024
Fix #79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.
@MaskRay MaskRay reopened this Jan 30, 2024
@MaskRay
Copy link
Member

MaskRay commented Jan 30, 2024

/cherry-pick 6485600

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Jan 30, 2024
Fix llvm#79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.

(cherry picked from commit 6485600)
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2024

/pull-request #80068

@tstellar
Copy link
Collaborator

tstellar commented Feb 7, 2024

PR has been created, we will track status there.

@tstellar tstellar closed this as completed Feb 7, 2024
@github-project-automation github-project-automation bot moved this from Needs Fix to Done in LLVM Release Status Feb 7, 2024
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 9, 2024
Fix llvm#79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.

(cherry picked from commit 6485600)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
Fix llvm#79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.

(cherry picked from commit 6485600)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
Fix llvm#79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.

(cherry picked from commit 6485600)
tstellar pushed a commit to tstellar/llvm-project that referenced this issue Feb 14, 2024
Fix llvm#79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.

(cherry picked from commit 6485600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

6 participants