Previously we didn't call the hook on a file in an archive, which let the PE/COFF port fail to link files in archives. It was a simple mistake. Added a call to the hook and also added a test to catch that error. const_cast is an unfortunate hack. Files in the resolver are usually const, but they are not actually const objects, since they are mutated if either a file is taken from an archive (an archive file does never return the same file twice) or the beforeLink hook is called. Maybe we should just remove const from there -- because they are not const. llvm-svn: 230808
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
# Test if the linker can properly parse the .drectve section contents.
|
|
# "drectve.obj" contains "/defaultlib:vars /subsystem:console,42.195 -?foo"
|
|
# in its .drectve section.
|
|
|
|
# RUN: yaml2obj %p/Inputs/drectve.obj.yaml > %t.obj
|
|
#
|
|
# RUN: lld -flavor link /out:%t.exe /entry:main /opt:noref /libpath:%p/Inputs \
|
|
# RUN: -- %t.obj >& %t.log
|
|
#
|
|
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=HEADER %s
|
|
# RUN: llvm-objdump -p %t.exe | FileCheck -check-prefix=IMPORT %s
|
|
# RUN: echo >> %t.log
|
|
# RUN: FileCheck -check-prefix=ERROR %s < %t.log
|
|
|
|
HEADER: MajorOperatingSystemVersion: 42
|
|
HEADER: MinorOperatingSystemVersion: 195
|
|
|
|
IMPORT: DLL Name: vars.dll
|
|
IMPORT-NEXT: Hint/Ord Name
|
|
IMPORT-NEXT: 0 _name_with_underscore
|
|
IMPORT-NEXT: 1 fn
|
|
IMPORT-NEXT: 1
|
|
|
|
ERROR-NOT: foo
|
|
|
|
|
|
# drectve2.obj contains "/include:foo".
|
|
# RUN: yaml2obj %p/Inputs/drectve2.obj.yaml > %t2.obj
|
|
# RUN: not lld -flavor link /out:%t2.exe /entry:main -- %t2.obj >& %t2.log
|
|
# RUN: FileCheck -check-prefix=UNDEF2 %s < %t2.log
|
|
|
|
UNDEF2: Undefined symbol: {{.*}}: foo
|
|
|
|
# drectve4.lib contains "/include:bar".
|
|
# RUN: not lld -flavor link /force /out:%t3.exe /entry:main /include:_fn1 -- \
|
|
# RUN: %t2.obj %p/Inputs/drectve3.lib >& %t3.log
|
|
# RUN: FileCheck -check-prefix=UNDEF3 %s < %t3.log
|
|
|
|
UNDEF3: Undefined symbol: {{.*}}: bar
|