https://sourceware.org/bugzilla/show_bug.cgi?id=18344
Bug ID: 18344 Summary: ld emits unnecessary line breaks that pollute the output of compilers. Product: binutils Version: 2.25 Status: NEW Severity: minor Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: saulery at free dot fr Target Milestone: --- Hello Dear Maintainer, I use the FreePascal Compiler (FPC) which is called ld to link its libraries as follows: $fpc msg2inc Free Pascal Compiler version 2.6.4+dfsg-4 [2014/10/14] for x86_64 Copyright (c) 1993-2014 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling msg2inc.pp msg2inc.pp(64,3) Note: Local variable "code" is assigned but never used Linking msg2inc /usr/bin/ld.bfd warning: link.res contains output sections; did you forget -T? 823 lines compiled, 0.3 sec 1 note(s) issued According to the program compiled the number of unnecessary newlines is greater or less. FPC calls ld as follows: /usr/bin/ld.bfd -b elf64-x86-64 -melf_x86_64 -s -L. -o msg2inc link.res After a long search, I was able to determine that the lexer (ld/ldlex.c) called an ECHO command that does nothing, except printing a useless character (see extracts below file, line 3214): 1891 /* Copy whatever the last rule matched to the standard output. */ 1892 #ifndef ECHO 1893 /* This used to be an fputs(), but since the string might contain NUL's, 1894 * we now use fwrite(). 1895 */ 1896 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 1897 #endif [...] 3206 case 197: 3207 YY_RULE_SETUP 3208 #line 473 "ldlex.l" 3209 lex_warn_invalid (" in expression", yytext); 3210 YY_BREAK 3211 case 198: 3212 YY_RULE_SETUP 3213 #line 475 "ldlex.l" 3214 ECHO; 3215 YY_BREAK The culprit line is generated from the ldlex.l file (line 475): 472 <SCRIPT,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>. lex_warn_invalid (" in script", yytext); 473 <EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid (" in expression", yytext); 474 475 %% 476 ^L 477 478 /* Switch flex to reading script file NAME, open on FILE, 479 saving the current input info on the include stack. */ From there, I do not know if flex is involved, or if it is misused. Regards, -- Stéphane Aulery -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils