Bug in get_board_flags for ld testsuite
Bug in DejaGnu testsuite helper for ld, where get_board_flags incorrectly returns empty flags due to an empty target_info name.
Jan Dubiec identified a bug in the get_board_flags procedure within binutils’ ld testsuite (ld/testsuite/lib/ld-lib.exp). The procedure is intended to retrieve compiler and linker flags from board descriptions but fails because [target_info name] returns an empty string, causing it to incorrectly return empty flags. The author seeks help to fix this DejaGnu-related issue.
- proposer
Reports a bug in `get_board_flags` where it returns empty CFLAGS/LDFLAGS because `[target_info name]` is empty during test execution. Seeks assistance to fix the DejaGnu logic.
“What is the get_board_flags procedure in ld/testsuite/lib/ld-lib.exp supposed to do? Return the cflags and ldflags defined in the board description file, right? But it doesn't seem to do that. Unfortunately, I don't know enough about DejaGnu's target/board handling to figure out how this should be fixed, so I'd appreciate some help from someone more experienced. Some information is provided belo…”
In Details
This discussion highlights a problem in the DejaGnu testsuite for the GNU linker (ld). Specifically, the get_board_flags helper function, responsible for setting up target-specific CFLAGS and LDFLAGS from board configurations, fails. The root cause appears to be that [target_info name] is evaluating to an empty string within the test context, preventing board_info from correctly retrieving the flags. The contributor has added diagnostic verbose statements to illustrate the issue.
- ld
- The GNU linker, responsible for combining object files into an executable or library.
- DejaGnu
- A testing framework for C programs, often used for toolchains. It provides a high-level interface for running tests and examining results.
- ld/testsuite/lib/ld-lib.exp
- A Tcl script file within the binutils source tree that contains helper procedures and configurations for testing the GNU linker.
- get_board_flags
- A function within the DejaGnu test framework that retrieves board-specific compiler and linker flags.
- target_info name
- A DejaGnu Tcl variable or command that should hold the name of the current target system being tested.
- board_info
- A DejaGnu function that accesses configuration information for a specific target board.
- CFLAGS
- Compiler flags passed to the C compiler.
- LDFLAGS
- Linker flags passed to the linker.