Skip to content

Actually test linker script processing #6578

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions regression/ansi-c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ endif
ifeq ($(BUILD_ENV_),MSVC)
excluded_tests = -X gcc-only
else
ifeq ($(BUILD_ENV_),OSX)
# In MacOS, a change in the assert.h header file
# is causing template errors when exercising the
# C++ front end (because of a transitive include
# of <type_traits>) for files that include the
# <assert.h> or <cassert> headers.
OS := $(shell uname)
ifeq ($(OS),Darwin)
excluded_tests = -X macos-assert-broken
endif
excluded_tests = -X macos-assert-broken
endif
endif

test:
Expand Down
7 changes: 3 additions & 4 deletions regression/cbmc-cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ include ../../src/common
ifeq ($(BUILD_ENV_),MSVC)
excluded_tests = -X gcc-only -X winbug
else
ifeq ($(BUILD_ENV_),OSX)
# In MacOS, a change in the assert.h header file
# is causing template errors when exercising the
# C++ front end (because of a transitive include
# of <type_traits>) for files that include the
# <assert.h> or <cassert> headers.
OS := $(shell uname)
ifeq ($(OS),Darwin)
excluded_tests = -X macos-assert-broken
endif
excluded_tests = -X macos-assert-broken
endif
endif

test:
Expand Down
7 changes: 3 additions & 4 deletions regression/cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ endif
ifeq ($(BUILD_ENV_),MSVC)
excluded_tests = -X gcc-only -X winbug
else
ifeq ($(BUILD_ENV_),OSX)
# In MacOS, a change in the assert.h header file
# is causing template errors when exercising the
# C++ front end (because of a transitive include
# of <type_traits>) for files that include the
# <assert.h> or <cassert> headers.
OS := $(shell uname)
ifeq ($(OS),Darwin)
excluded_tests = -X macos-assert-broken
endif
excluded_tests = -X macos-assert-broken
endif
endif

test:
Expand Down
16 changes: 15 additions & 1 deletion regression/goto-gcc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(not_gnu_ld -X gnu-ld-only)
else()
set(not_gnu_ld "")
endif()

# TARGET_FILE (as used in other directories) can't be used with goto-gcc as it
# isn't marked as an executable (target), which CMake requires. Thus construct a
# path in the same way the symbolic link is created in the goto-cc directory.
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc")
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc" ${not_gnu_ld})

add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a"
COMMAND "$<TARGET_FILE_DIR:goto-cc>/goto-gcc" -c foo.c
Expand All @@ -15,3 +21,11 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a
add_custom_target(libour_archive.a ALL
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a"
)

if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set_property(
TEST "goto-gcc-CORE"
PROPERTY ENVIRONMENT
"PATH=$ENV{PATH}:$<TARGET_FILE_DIR:goto-cc>"
)
endif()
9 changes: 7 additions & 2 deletions regression/goto-gcc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ test:
tests.log: ../test.pl

else
ifeq ($(BUILD_ENV_),OSX)
not_gnu_ld = -X gnu-ld-only
endif
test: ../../src/goto-cc/goto-gcc
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
@PATH=../../../scripts:$$PATH \
../test.pl -e -p -c ../../../src/goto-cc/goto-gcc $(not_gnu_ld)

tests.log: ../test.pl ../../src/goto-cc/goto-gcc
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
@PATH=../../../scripts:$$PATH \
../test.pl -e -p -c ../../../src/goto-cc/goto-gcc $(not_gnu_ld)

../../src/goto-cc/goto-gcc: ../../src/goto-cc/goto-cc
@ln -sf goto-cc ../../src/goto-cc/goto-gcc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ extern char src_start[];
extern char src_end[];
extern char dst_start[];

void *memcpy(void *dest, void *src, unsigned n){
void *memcpy(void *dest, void *src, unsigned n)
{
return (void *)0;
}

int main(){
int main()
{
memcpy(dst_start, src_start, (unsigned)src_end - (unsigned)src_start);
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CORE
CORE gnu-ld-only
main.c
-o out.gb -T script.ld -nostdlib
-o out.gb -T script.ld -nostdlib -static -Wall
^EXIT=0$
^SIGNAL=0$
--
Problem parsing linker script
^warning: ignoring
^CONVERSION ERROR$
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ extern char src_start[];
extern char src_size[];
extern char dst_start[];

void *memcpy(void *dest, void *src, unsigned n){
void *memcpy(void *dest, void *src, unsigned n)
{
return (void *)0;
}

int main(){
int main()
{
memcpy(dst_start, src_start, (unsigned)src_size);
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CORE
CORE gnu-ld-only
main.c
-o out.gb -T script.ld -nostdlib
-o out.gb -T script.ld -nostdlib -static -Wall
^EXIT=0$
^SIGNAL=0$
--
Problem parsing linker script
^warning: ignoring
^CONVERSION ERROR$
--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extern char sym[];

int main(){
int main()
{
int foo = (int)sym;
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CORE
CORE gnu-ld-only
main.c
-o out.gb -T script.ld -nostdlib
-o out.gb -T script.ld -nostdlib -static -Wall
^EXIT=0$
^SIGNAL=0$
--
Problem parsing linker script
^warning: ignoring
^CONVERSION ERROR$
--
Expand Down
7 changes: 3 additions & 4 deletions regression/systemc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ endif
ifeq ($(BUILD_ENV_),MSVC)
excluded_tests = -X gcc-only -X winbug
else
ifeq ($(BUILD_ENV_),OSX)
# In MacOS, a change in the assert.h header file
# is causing template errors when exercising the
# C++ front end (because of a transitive include
# of <type_traits>) for files that include the
# <assert.h> or <cassert> headers.
OS := $(shell uname)
ifeq ($(OS),Darwin)
excluded_tests = -X macos-assert-broken
endif
excluded_tests = -X macos-assert-broken
endif
endif

default: tests.log
Expand Down
7 changes: 7 additions & 0 deletions src/goto-cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ else()
COMMAND "${CMAKE_COMMAND}" -E create_symlink
goto-cc $<TARGET_FILE_DIR:goto-cc>/goto-ld
BYPRODUCTS ${CMAKE_BINARY_DIR}/bin/goto-ld)
add_custom_command(TARGET goto-cc
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/ls_parse.py
$<TARGET_FILE_DIR:goto-cc>/ls_parse.py
BYPRODUCTS ${CMAKE_BINARY_DIR}/bin/ls_parse.py)

install(
FILES
${CMAKE_BINARY_DIR}/bin/goto-ld
${CMAKE_BINARY_DIR}/bin/goto-gcc
${CMAKE_BINARY_DIR}/bin/ls_parse.py
DESTINATION
${CMAKE_INSTALL_BINDIR})
endif()