Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3149201

Browse files
authored
Merge pull request#1091 from yamt/mach-o
adapt the linker sections usage to mach-o
2 parents6a43f3c +0d861b7 commit3149201

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

‎runners/bench_runner.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,13 @@ typedef struct bench_id {
123123

124124

125125
// bench suites are linked into a custom ld section
126+
#if defined(__APPLE__)
127+
externstructbench_suite__start__bench_suites __asm("section$start$__DATA$_bench_suites");
128+
externstructbench_suite__stop__bench_suites __asm("section$end$__DATA$_bench_suites");
129+
#else
126130
externstructbench_suite__start__bench_suites;
127131
externstructbench_suite__stop__bench_suites;
132+
#endif
128133

129134
conststructbench_suite*bench_suites=&__start__bench_suites;
130135
#defineBENCH_SUITE_COUNT \

‎runners/test_runner.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,13 @@ typedef struct test_id {
136136

137137

138138
// test suites are linked into a custom ld section
139+
#if defined(__APPLE__)
140+
externstructtest_suite__start__test_suites __asm("section$start$__DATA$_test_suites");
141+
externstructtest_suite__stop__test_suites __asm("section$end$__DATA$_test_suites");
142+
#else
139143
externstructtest_suite__start__test_suites;
140144
externstructtest_suite__stop__test_suites;
145+
#endif
141146

142147
conststructtest_suite*test_suites=&__start__test_suites;
143148
#defineTEST_SUITE_COUNT \

‎scripts/bench.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,15 @@ def write_case_functions(f, suite, case):
404404
f.writeln()
405405

406406
# create suite struct
407-
#
407+
f.writeln('#if defined(__APPLE__)')
408+
f.writeln('__attribute__((section("__DATA,_bench_suites")))')
409+
f.writeln('#else')
408410
# note we place this in the custom bench_suites section with
409411
# minimum alignment, otherwise GCC ups the alignment to
410412
# 32-bytes for some reason
411413
f.writeln('__attribute__((section("_bench_suites"), '
412414
'aligned(1)))')
415+
f.writeln('#endif')
413416
f.writeln('const struct bench_suite __bench__%s__suite = {'
414417
%suite.name)
415418
f.writeln(4*' '+'.name = "%s",'%suite.name)

‎scripts/test.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,15 @@ def write_case_functions(f, suite, case):
412412
f.writeln()
413413

414414
# create suite struct
415-
#
415+
f.writeln('#if defined(__APPLE__)')
416+
f.writeln('__attribute__((section("__DATA,_test_suites")))')
417+
f.writeln('#else')
416418
# note we place this in the custom test_suites section with
417419
# minimum alignment, otherwise GCC ups the alignment to
418420
# 32-bytes for some reason
419421
f.writeln('__attribute__((section("_test_suites"), '
420422
'aligned(1)))')
423+
f.writeln('#endif')
421424
f.writeln('const struct test_suite __test__%s__suite = {'
422425
%suite.name)
423426
f.writeln(4*' '+'.name = "%s",'%suite.name)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp