Skip to content

Commit 1b2472f

Browse files
Ignore lines with "in function" and "In function" (#534)
In recent binutils version, the warning, for stubbed functions, is properly printed and due to this correction, linking a project with stubbed functions fails the build in headless build rather than just printing the warnings. Example: .../arm-none-eabi/bin/ld.exe: .../libc.a(libc_a-writer.o): in function `_write_r': (.text._write_r+0x10): warning: _write is not implemented and will always fail ... 12:02:52 Build Failed. 8 errors, 8 warnings. (took 6s.284ms) The first line matches the error pattern (.*[/\\])?ld(\.exe)?: (.*) that incorectly fails the build in headless mode (a single line matching a pattern with severity "error" fails the build) when there are really only warnings in the build log. The problem can be obsered using the GCC 11 (and later) toolchain builds with newlib for the arm-none-eabi target provided by Arm. Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
1 parent 517b3a9 commit 1b2472f

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,46 @@ public void testLinkerMessages_bug495661() throws IOException {
122122
"make: *** [makefile:47: parser] Error 1",
123123
"\"make all\" terminated with exit code 2. Build might be incomplete.", },
124124
// @formatter:on
125-
2, // errors
125+
1, // errors
126126
0, // warnings
127127
0, // Infos
128-
new String[] { "a.cpp", "project" },
129-
new String[] { "./src/a.o: in function `TLS wrapper function for A::max_compatdb_time':",
130-
"undefined reference to `A::max_compatdb_time'" },
128+
new String[] { "a.cpp" }, new String[] { "undefined reference to `A::max_compatdb_time'" },
131129
new String[] { GLD_ERROR_PARSER_ID });
132130
}
131+
132+
@Test
133+
public void testLinkerMessages_stubbed_function() throws IOException {
134+
runParserTest(new String[] { "make all ",
135+
// @formatter:off
136+
"Building target: f4.elf",
137+
"Invoking: Cross GCC Linker",
138+
"arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 --specs=nosys.specs -o \"f4.elf\" ./Src/main.o",
139+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-closer.o): in function `_close_r':",
140+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail",
141+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-fstatr.o): in function `_fstat_r':",
142+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/fstatr.c:55: warning: _fstat is not implemented and will always fail",
143+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-signalr.o): in function `_getpid_r':",
144+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/signalr.c:83: warning: _getpid is not implemented and will always fail",
145+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-isattyr.o): in function `_isatty_r':",
146+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/isattyr.c:52: warning: _isatty is not implemented and will always fail",
147+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-signalr.o): in function `_kill_r':",
148+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/signalr.c:53: warning: _kill is not implemented and will always fail",
149+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-lseekr.o): in function `_lseek_r':",
150+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/lseekr.c:49: warning: _lseek is not implemented and will always fail",
151+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-readr.o): in function `_read_r':",
152+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/readr.c:49: warning: _read is not implemented and will always fail",
153+
"c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/thumb/v7e-m/nofp/libc.a(libc_a-writer.o): in function `_write_r':",
154+
"/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/writer.c:49: warning: _write is not implemented and will always fail",
155+
"Finished building target: f4.elf",
156+
" ",
157+
"",
158+
"14:37:57 Build Failed. 8 errors, 8 warnings. (took 1s.244ms)"},
159+
// @formatter:on
160+
0, // errors
161+
8, // warnings
162+
0, // Infos
163+
null, new String[] { /* Don't really know what to add here */ },
164+
new String[] { GLD_ERROR_PARSER_ID, GCC_ERROR_PARSER_ID });
165+
166+
}
133167
}

core/org.eclipse.cdt.core/plugin.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ CDTGNUCErrorParser.regex.GenericWarning=(.*?):(\\d+):(\\d+:)?\\s*(([Ww]arning)|(
7272
CDTGNUCErrorParser.regex.OtherError=(.*?):(\\d+):(\\d+:)? (.*)
7373

7474
CDTGNULinkerErrorParser.name=GNU Linker Error Parser
75-
CDTGNULinkerErrorParser.regex.InFunction=(.*?):?(\\(\\.[^\\s+]+\\+.*\\))?:\\s*(In function [`'"](.*)['"]:)
75+
CDTGNULinkerErrorParser.regex.InFunction=(.*?):?(\\(\\.[^\\s+]+\\+.*\\))?:\\s*([Ii]n function [`'"](.*)['"]:)
7676
CDTGNULinkerErrorParser.regex.WarningDangerousFunction=(.*?):(\\d+):(\\d+:)? ([Ww]arning:)?\\s*(the use of [`'"](.*)['"] is dangerous, better use [`'"](.*)['"].*)
7777
CDTGNULinkerErrorParser.regex.TextWarning=(.*?):?\\(\\.[^\\s+]+\\+.*\\): [Ww]arning:? (.*)
7878
CDTGNULinkerErrorParser.regex.TextError=(.*?):?\\(\\.[^\\s+]+\\+.*\\): (.*)

0 commit comments

Comments
 (0)