DynamoRIO / DynamoRIO/drmemory

drsyscall has undefined symbols and drstrace_unit_tests fails to build from toupper()

Open
#1,785 4 comments 0 reactions 0 assignees View on GitHub
Component-Build Priority-Low
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

drsyscall has undefined symbols and drstrace_unit_tests fails to build due to recent toupper changes in
0087d1ce6aecc8e889abb52e8d66a968055ac4e0

```
> grep -i error /tmp/OUT32*
/tmp/OUT32B:
/tmp/OUT32B:
```

Not present in 5.1.0 RC1. Due to recent change to strcasecmp to swap to
toupper (better for Turkish) and to use islower (b/c Windows toupper fails
on non-lower):

```
if (IF_WINDOWS(__isascii(ut) &&) islower(ut))
7700bd7e: e8 6d ab ff ff callq 770068f0 <__ctype_b_loc@plt>
7700bd83: 48 8b 10 mov (%rax),%rdx
7700bd86: 4c 0f be fd movsbq %bpl,%r15
7700bd8a: 42 f6 44 7a 01 02 testb $0x2,0x1(%rdx,%r15,2)
7700bd90: 74 15 je 7700bda7
7700bd92: 48 89 14 24 mov %rdx,(%rsp)
ut = (char)toupper(ut);
7700bd96: e8 c5 ab ff ff callq 77006960 <__ctype_toupper_loc@plt>
```

The tolower() that was there before comes from DR's string.c.

For drmemorylib, libc is pulled in, so ctype\* are resolved. drsyscall does
not import from libc at all.

If we put in our own islower and toupper, they will only work for ascii, so
on the one hand it's better to use libc.
OTOH we don't want these references for libs that do not want libc, and
drsyscall only uses strcasestr for its own internal stuff.

We also have a build error in drmem w/ separate DR:

```
libcmtd.lib(_ctype.obj) : error LNK2005: _islower already defined in ntdll_imports.lib(ntdll.dll)
Creating library bin\debug\drstrace_unit_tests.lib and object bin\debug\drstrace_unit_tests.exp
bin\drstrace_unit_tests.exe : fatal error LNK1169: one or more multiply defined symbols found
```

Xref DynamoRIO/dynamorio/issues/943.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.