GAS: Add WORKING_DOT_WORD to tc-pdp11.h
Patch adds WORKING_DOT_WORD to PDP-11 GAS configuration to fix .WORD directive issues.
Jan Brittenson proposes adding the WORKING_DOT_WORD define to the PDP-11 GAS configuration. This change aims to fix an issue where .WORD directives with forward references could produce incorrect 8-byte sequences on the strictly 16-bit PDP-11 architecture. The define is intended to disable a workaround that is not needed for this architecture.
- proposer
Submitted a patch to add WORKING_DOT_WORD to tc-pdp11.h, explaining it resolves issues with .WORD directives.
“Without WORKING_DOT_WORD for pdp11 a .WORD with a forward reference will sometimes produce bogus 8-byte sequences. Since it's strictly 16-bit, it should never need the workaround this #define turns off.”
- reviewer
Questioned the rationale for disabling the workaround without sufficient explanation, requesting more context on WORKING_DOT_WORD's purpose.
“This is too little of an explanation for suddenly, after many years, disabling a workaround. (It's not even clear to me whether WORKING_DOT_WORD is purely a gas-internal thing, or providing some level of "compatibility" with native assemblers. In”
- reviewer
Agreed with Jan Beulich that the explanation is insufficient and suggested that the workaround is likely unnecessary for the PDP-11's 16-bit architecture.
“I agree with Jan ...er, Jan B ...er, "bson" (just cherishing the name collision :) that this doesn't seem useful in the PDP11 world, where you wouldn't need handling overflow of 16-bit signed offsets in a 32-bit context as it's all 16-bit.”
- reviewer
Suggested creating a bug report with a test case if the issue is indeed reproducible, and proposed an alternative define name.
“That said, a test-case for PDP11 where this produced wrong code would be interesting. May I suggest to open a bugzilla entry and add assembly code there? brgds, H-P”
- proposer
Responded to feedback, suggesting that only a few machines (m68k, s390) require the workaround and that defining BROKEN_DOT_WORD might be a clearer approach.
“Yeah, as far as I can tell there's only two machines that require, or rely on it: m68k and s390. Every”
- reviewer
Suggested an alternative approach of defining BROKEN_DOT_WORD instead of WORKING_DOT_WORD for clarity.
Technical Tradeoffs
- Disabling a workaround for specific architectures versus maintaining compatibility or robustness for others.
- Clarity of macro definitions (e.g., `WORKING_DOT_WORD` vs. `BROKEN_DOT_WORD`).
In Details
This patch addresses a specific issue in the PDP-11 GAS backend related to the .WORD directive when dealing with forward symbol references. The WORKING_DOT_WORD macro, when defined, disables a workaround that was originally intended for architectures where 16-bit operations might interact with larger address spaces, potentially causing issues. For the PDP-11, which is strictly 16-bit, this workaround is unnecessary and can lead to incorrect code generation (bogus 8-byte sequences). The patch adds this define to tc-pdp11.h to correct this behavior.
- GAS
- The GNU Assembler.
- WORKING_DOT_WORD
- A preprocessor macro used in GAS to control specific behaviors related to the
.WORDdirective, often to disable workarounds on architectures where they are not needed. - PDP-11
- A popular 16-bit minicomputer from Digital Equipment Corporation, known for its influence on computer architecture and programming.
- .WORD directive
- An assembler directive that defines a 16-bit data word.
- Forward reference
- A reference to a symbol (like a label or variable) that is defined later in the source code.