Bug 30554

Summary: glibcpp.py doesn't handle "\"
Product: glibc Reporter: Maxim Kuvyrkov <maxim.kuvyrkov>
Component: buildAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: carlos, fweimer
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Maxim Kuvyrkov 2023-06-15 09:03:50 UTC
This patch [1] to update elf/elf.h fails pre-commit testing due to failures in ...
===
Running glibc:elf ...
FAIL: elf/tst-glibcelf 
FAIL: elf/tst-relro-ldso 
FAIL: elf/tst-relro-libc 
===
... tests.

All these tests fail with the following error ...
===
$ cat tst-glibcelf.out 
/home/maxim.kuvyrkov/tcwg_gnu/glibc/scripts/../elf/elf.h:1708: error: uninterpretable macro token sequence: \
0x02000000
Traceback (most recent call last):
 File "/home/maxim.kuvyrkov/tcwg_gnu/glibc/elf/tst-glibcelf.py", line 23, in <module>
   import glibcelf
 File "/home/maxim.kuvyrkov/tcwg_gnu/glibc/scripts/glibcelf.py", line 226, in <module>
   _elf_h = _parse_elf_h()
 File "/home/maxim.kuvyrkov/tcwg_gnu/glibc/scripts/glibcelf.py", line 223, in _parse_elf_h
   raise IOError('parse error in elf.h')
OSError: parse error in elf.h
===
... while parsing new lines:
#define EF_MIPS_ARCH_ASE_MICROMIPS \
				0x02000000 /* Use MICROMIPS ISA
					      extensions.  */

The workaround to unblock this patch is to remove "\" from the macro definition, but it would be nice to improve glibcpp.py to handle split lines.

[1] https://patchwork.sourceware.org/project/glibc/patch/20230606061328.245050-1-ying.huang@oss.cipunited.com/
Comment 1 Maxim Kuvyrkov 2023-06-15 09:07:22 UTC
Hi Florian,

Could you take a look at this?  After looking for a few minutes at glibcpp.py it doesn't seem like I can figure this out quickly.
Comment 2 Florian Weimer 2023-06-15 10:47:38 UTC
I agree it probably falls on me to implement this, but it's going to take some time until I can look into this, sorry.