Skip to content

Commit 181ab42

Browse files
authored
Merge pull request #6578 from tautschnig/bugfixes/linker-script-testing
Actually test linker script processing
2 parents 087296a + 4f84963 commit 181ab42

File tree

16 files changed

+60
-30
lines changed

16 files changed

+60
-30
lines changed

regression/ansi-c/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ endif
1212
ifeq ($(BUILD_ENV_),MSVC)
1313
excluded_tests = -X gcc-only
1414
else
15+
ifeq ($(BUILD_ENV_),OSX)
1516
# In MacOS, a change in the assert.h header file
1617
# is causing template errors when exercising the
1718
# C++ front end (because of a transitive include
1819
# of <type_traits>) for files that include the
1920
# <assert.h> or <cassert> headers.
20-
OS := $(shell uname)
21-
ifeq ($(OS),Darwin)
22-
excluded_tests = -X macos-assert-broken
23-
endif
21+
excluded_tests = -X macos-assert-broken
22+
endif
2423
endif
2524

2625
test:

regression/cbmc-cpp/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ include ../../src/common
66
ifeq ($(BUILD_ENV_),MSVC)
77
excluded_tests = -X gcc-only -X winbug
88
else
9+
ifeq ($(BUILD_ENV_),OSX)
910
# In MacOS, a change in the assert.h header file
1011
# is causing template errors when exercising the
1112
# C++ front end (because of a transitive include
1213
# of <type_traits>) for files that include the
1314
# <assert.h> or <cassert> headers.
14-
OS := $(shell uname)
15-
ifeq ($(OS),Darwin)
16-
excluded_tests = -X macos-assert-broken
17-
endif
15+
excluded_tests = -X macos-assert-broken
16+
endif
1817
endif
1918

2019
test:

regression/cpp/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ endif
1212
ifeq ($(BUILD_ENV_),MSVC)
1313
excluded_tests = -X gcc-only -X winbug
1414
else
15+
ifeq ($(BUILD_ENV_),OSX)
1516
# In MacOS, a change in the assert.h header file
1617
# is causing template errors when exercising the
1718
# C++ front end (because of a transitive include
1819
# of <type_traits>) for files that include the
1920
# <assert.h> or <cassert> headers.
20-
OS := $(shell uname)
21-
ifeq ($(OS),Darwin)
22-
excluded_tests = -X macos-assert-broken
23-
endif
21+
excluded_tests = -X macos-assert-broken
22+
endif
2423
endif
2524

2625
test:

regression/goto-gcc/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
2+
set(not_gnu_ld -X gnu-ld-only)
3+
else()
4+
set(not_gnu_ld "")
5+
endif()
6+
17
# TARGET_FILE (as used in other directories) can't be used with goto-gcc as it
28
# isn't marked as an executable (target), which CMake requires. Thus construct a
39
# path in the same way the symbolic link is created in the goto-cc directory.
4-
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc")
10+
add_test_pl_tests("$<TARGET_FILE_DIR:goto-cc>/goto-gcc" ${not_gnu_ld})
511

612
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a"
713
COMMAND "$<TARGET_FILE_DIR:goto-cc>/goto-gcc" -c foo.c
@@ -15,3 +21,11 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a
1521
add_custom_target(libour_archive.a ALL
1622
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/archives/libour_archive.a"
1723
)
24+
25+
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
26+
set_property(
27+
TEST "goto-gcc-CORE"
28+
PROPERTY ENVIRONMENT
29+
"PATH=$ENV{PATH}:$<TARGET_FILE_DIR:goto-cc>"
30+
)
31+
endif()

regression/goto-gcc/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ test:
99
tests.log: ../test.pl
1010

1111
else
12+
ifeq ($(BUILD_ENV_),OSX)
13+
not_gnu_ld = -X gnu-ld-only
14+
endif
1215
test: ../../src/goto-cc/goto-gcc
13-
@../test.pl -e -p -c ../../../src/goto-cc/goto-gcc
16+
@PATH=../../../scripts:$$PATH \
17+
../test.pl -e -p -c ../../../src/goto-cc/goto-gcc $(not_gnu_ld)
1418

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

1823
../../src/goto-cc/goto-gcc: ../../src/goto-cc/goto-cc
1924
@ln -sf goto-cc ../../src/goto-cc/goto-gcc

regression/ansi-c/linker_script_start+end/main.c renamed to regression/goto-gcc/linker_script_start+end/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ extern char src_start[];
22
extern char src_end[];
33
extern char dst_start[];
44

5-
void *memcpy(void *dest, void *src, unsigned n){
5+
void *memcpy(void *dest, void *src, unsigned n)
6+
{
67
return (void *)0;
78
}
89

9-
int main(){
10+
int main()
11+
{
1012
memcpy(dst_start, src_start, (unsigned)src_end - (unsigned)src_start);
1113
return 0;
1214
}

regression/ansi-c/linker_script_start+end/test.desc renamed to regression/goto-gcc/linker_script_start+end/test.desc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
CORE
1+
CORE gnu-ld-only
22
main.c
3-
-o out.gb -T script.ld -nostdlib
3+
-o out.gb -T script.ld -nostdlib -static -Wall
44
^EXIT=0$
55
^SIGNAL=0$
66
--
7+
Problem parsing linker script
78
^warning: ignoring
89
^CONVERSION ERROR$
910
--

regression/ansi-c/linker_script_start+size/main.c renamed to regression/goto-gcc/linker_script_start+size/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ extern char src_start[];
22
extern char src_size[];
33
extern char dst_start[];
44

5-
void *memcpy(void *dest, void *src, unsigned n){
5+
void *memcpy(void *dest, void *src, unsigned n)
6+
{
67
return (void *)0;
78
}
89

9-
int main(){
10+
int main()
11+
{
1012
memcpy(dst_start, src_start, (unsigned)src_size);
1113
return 0;
1214
}

regression/ansi-c/linker_script_start+size/test.desc renamed to regression/goto-gcc/linker_script_start+size/test.desc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
CORE
1+
CORE gnu-ld-only
22
main.c
3-
-o out.gb -T script.ld -nostdlib
3+
-o out.gb -T script.ld -nostdlib -static -Wall
44
^EXIT=0$
55
^SIGNAL=0$
66
--
7+
Problem parsing linker script
78
^warning: ignoring
89
^CONVERSION ERROR$
910
--
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extern char sym[];
22

3-
int main(){
3+
int main()
4+
{
45
int foo = (int)sym;
56
return 0;
67
}

regression/ansi-c/linker_script_symbol-only/test.desc renamed to regression/goto-gcc/linker_script_symbol-only/test.desc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
CORE
1+
CORE gnu-ld-only
22
main.c
3-
-o out.gb -T script.ld -nostdlib
3+
-o out.gb -T script.ld -nostdlib -static -Wall
44
^EXIT=0$
55
^SIGNAL=0$
66
--
7+
Problem parsing linker script
78
^warning: ignoring
89
^CONVERSION ERROR$
910
--

regression/systemc/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ endif
1212
ifeq ($(BUILD_ENV_),MSVC)
1313
excluded_tests = -X gcc-only -X winbug
1414
else
15+
ifeq ($(BUILD_ENV_),OSX)
1516
# In MacOS, a change in the assert.h header file
1617
# is causing template errors when exercising the
1718
# C++ front end (because of a transitive include
1819
# of <type_traits>) for files that include the
1920
# <assert.h> or <cassert> headers.
20-
OS := $(shell uname)
21-
ifeq ($(OS),Darwin)
22-
excluded_tests = -X macos-assert-broken
23-
endif
21+
excluded_tests = -X macos-assert-broken
22+
endif
2423
endif
2524

2625
default: tests.log

src/goto-cc/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,18 @@ else()
4141
COMMAND "${CMAKE_COMMAND}" -E create_symlink
4242
goto-cc $<TARGET_FILE_DIR:goto-cc>/goto-ld
4343
BYPRODUCTS ${CMAKE_BINARY_DIR}/bin/goto-ld)
44+
add_custom_command(TARGET goto-cc
45+
POST_BUILD
46+
COMMAND "${CMAKE_COMMAND}" -E copy
47+
${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/ls_parse.py
48+
$<TARGET_FILE_DIR:goto-cc>/ls_parse.py
49+
BYPRODUCTS ${CMAKE_BINARY_DIR}/bin/ls_parse.py)
4450

4551
install(
4652
FILES
4753
${CMAKE_BINARY_DIR}/bin/goto-ld
4854
${CMAKE_BINARY_DIR}/bin/goto-gcc
55+
${CMAKE_BINARY_DIR}/bin/ls_parse.py
4956
DESTINATION
5057
${CMAKE_INSTALL_BINDIR})
5158
endif()

0 commit comments

Comments
 (0)